Math 325: Differential Equations	Assignment 1 Solutions		Fall 1997

Problem 1

Verify that the functions
	y1[t_] = 1;      y2[t_] = t;
	y3[t_] = E^(-t); y4[t_] = t*E^(-t);
are solutions of the differential equation
	y''''[t] + 2y'''[t] + y''[t] == 0
and calculate their Wronskian.

Solution

L[y_] := D[y,{t,4}] + 2 D[y,{t,3}] + D[y,{t,2}];

Clear[y1,y2,y3,y4]

y1[t_] = 1;      y2[t_] = t;
y3[t_] = E^(-t); y4[t_] = t*E^(-t);

{L[y1[t]],L[y2[t]],L[y3[t]],L[y4[t]]}//Simplify

w[f1_,f2_,f3_,f4_] := Det[
{{  f1,         f2,         f3,         f4   },
 {D[f1,t],    D[f2,t],    D[f3,t],    D[f4,t]},
 {D[f1,{t,2}],D[f2,{t,2}],D[f3,{t,2}],D[f4,{t,2}]},
 {D[f1,{t,3}],D[f2,{t,3}],D[f3,{t,3}],D[f4,{t,3}]}}];

w[y1[t],y2[t],y3[t],y4[t]]

Problem 2

Show that the Wronskian of Cos[t], Cos[t]^3, Cos[t]^5, and Cos[5t] is 0.
Establish this result without direct evaluation of the Wronskian.

Solution

w[Cos[t],Cos[t]^3,Cos[t]^5,Cos[5t]]

Simplify[%]

To prove that these functions are linearly dependent, and hence the Wronskian must be identically zero, use trig identities like
	Cos[A+B] -> Cos[A]Cos[B] - Sin[A]Sin[B];
	Sin[A+B] -> Sin[A]Cos[B] + Cos[A]Sin[B];

Cos[5t] == Cos[2t]Cos[3t] - Sin[2t]Sin[3t]

% /.{Cos[3t]->Cos[t]Cos[2t] - Sin[t]Sin[2t],
 	 Sin[3t]->Sin[t]Cos[2t] + Cos[t]Sin[2t]} //ExpandAll

% /.{Cos[2t]->Cos[t]^2-Sin[t]^2, Sin[2t]->2Sin[t]Cos[t]}//ExpandAll

% /.{Sin[t]^2->1-Cos[t]^2, Sin[t]^4->(1- Cos[t]^2)2}//ExpandAll

Thus, we get the linear dependence relation:

Cos[5t] - 10 Cos[t] + 20 Cos[t]^3 - 11 Cos[t]^5 == 0

Problem 3

Find all the 10th roots of 1024, including complex numbers. Convert these to points in the plane and plot them.

Solution

Solve[z^10 == 1024]

pts = {Re[z],Im[z]}/.%

ListPlot[pts,AspectRatio->1]

Another method: use polar coordinates {r Cos[t], r Sin[t]}.

N[1024^(1/10)]

pts = Table[{2 Cos[2Pi k/10], 2 Sin[2Pi k/10]}, {k,0,9}]

Problem 4

Find the roots of the characteristic equation and the corrseponding fundamental solutions to the differential equation
	y''''[t] + 6y'''[t] + 17y''[t] + 22y'[t] + 14y[t] == 0
Superimpose plots of the fundamental solutions.Then find and plot the particular solution that satisfies the initial conditions:
	y[0] == 1, y'[0] == 1, y''[0]==1, y'''[0] == 1
Compare your solution with the solution given by DSolve[].

Solution

Solve[r^4 + 6r^3 + 17r^2 + 22r + 14 == 0]

The corresponding fundamental solutions are:

y1 = E^(-t)Cos[t];         y2 = E^(-t)Sin[t];
y3 = E^(-2t)Cos[Sqrt[3]t]; y4 = E^(-2t)Sin[Sqrt[3]t];

Plot[{y1,y2,y3,y4}, {t,0,2Pi}, PlotRange->{-0.2,1.1}]

To find the particular solution phi[t]:

phi[t_] = c1 y1 + c2 y2 + c3 y3 + c4 y4

eqns = {phi[0]==1,phi'[0]==1,phi''[0]==1,phi'''[0]==1}

Solve[eqns]

phi[t] /. First[%]

Plot[%, {t,0,2Pi}]

DSolve[{y''''[t] + 6y'''[t] + 17y''[t] + 22y'[t] + 14y[t] == 0,
	y[0] == 1, y'[0] == 1, y''[0]==1, y'''[0] == 1},y[t],t]

Plot[y[t]/.First[%],{t,0,2Pi}]

Problem 5

Find the general solution to the following differential equation using the method of undetermined coefficents.
	y''''[t] + 2y'''[t] + 5y''[t] + 8y'[t] + 4y[t]==Sin[2t] + t*E^(-t)
Superimpose plots of the particular solutions satisfying
	y[0] == y0, y'[0] == 0, y''[0] == 0, y'''[0] == 0
for several values of y0. Explain why all these solutions seem to pass through the t-axis at the same points and at regular intervals for large values of t. Try to determine the length of this common interval.

Solution

Solve[r^4 + 2r^3 + 5r^2 + 8r + 4 == 0]

The general solution to the homogeneous equation is:

y[t_] = c1 E^(-t) + c2 t*E^(-t) + c3 Cos[2t] + c4 Sin[2t];

A solution to the non-homogeneous equation should have the form

Y[t_] = t(a Cos[2t] + b Sin[2t]) + t^2(c*t + d)E^(-t);

The usual guesses must be multiplied by powers of t for otherwise they would satisfy the homogeneous equation (and give 0 instead of the desired function). To find the correct values of the constants, we plug into the equation.

L[y_] := D[y,{t,4}]+2D[y,{t,3}]+5D[y,{t,2}]+8D[y,t]+4y;

L[Y[t]] == (Sin[2t] + t*E^(-t))//ExpandAll

Equating coefficients of like terms we get

eqns = {-12c + 10d == 0, 30c == 1,
        -16a - 12b == 0, 12a - 16b == 1};

sol = Solve[eqns]

The general solution to the non-homogeneous equation is then

phi[t_] = y[t] + Y[t] /. First[sol]

Let's check it is a solution:

L[phi[t]]//Simplify

Particular solutions:

eqns = {phi[0]==y0, phi'[0]==0, phi''[0]==0, phi'''[0]==0}

sol = Solve[eqns,{c1,c2,c3,c4}]

y[y0_,t_] = phi[t] /. First[sol]

Plot[Evaluate[Table[y[y0,t],{y0,0,5}]],{t,0,15},
PlotRange->{-1,5}]

The dominant terms for large values of t for all these solutions are

-(75/625) y0  Cos[2 t] + (800/5000) y0 Sin[2 t] + 
        t ((3/100) Cos[2 t] - (1/25) Sin[2 t]) // Simplify

This expression vanishes (for any y0) when 3 Cos[2 t]-4 Sin[2 t] == 0, i.e., when
t == (ArcTan[3/4] + k*Pi)/2. The interval between successive zeros of the solutions is then approximately Pi/2.

Problem 6

Find approximate values of the solution of the initial value problem
	y'[t] == (t^2 - y[t]^2) Sin[y[t]], y[0] = 1
at t==1 using the Euler method with h = 0.1, h = 0.05, and h = 0.025. Compare these results with the output of NDSolve[] by superimposing plots of the data.

Solution

f[t_,y_] = (t^2 - y^2) Sin[y];

EMStep[{t_,y_}] := N[{t+h,y+h*f[t,y]}];

h = 0.1;

To reach the point t==1.0 with this step size we need 10 steps.

soln1=NestList[EMStep,{0,1},10]

p1 = ListPlot[soln1,PlotJoined->True,
     PlotStyle->RGBColor[0,1,0]]

h = 0.05;

Twenty steps are neede for this case.

soln2=NestList[EMStep,{0,1},20]

p2 = ListPlot[soln2,PlotJoined->True,
     PlotStyle->RGBColor[0,0,1]]

h = 0.025;

soln3=NestList[EMStep,{0,1},40]

p3 = ListPlot[soln3,PlotJoined->True,
     PlotStyle->RGBColor[1,0,0]]

soln = NDSolve[{y'[t]==(t^2-y[t]^2) Sin[y[t]],y[0] == 1}, y[t],
       {t,0,1}]

y[t_] = y[t]/.First[soln];

y[1.0]

p = Plot[y[t],{t,0,1}]

Show[p1,p2,p3,p]

Problem 7

Find approximate values of the solution of the initial value problem
	y'[t] == (t^2 - y[t]^2) Sin[y[t]], y[0] = 1
using the Runge-Kutta method with h = 0.1, h = 0.05, and h = 0.025. Compare these results with the output of NDSolve[] (from Problem 6) by superimposing plots of the data.

Solution

Clear[y]

f[t_,y_] = (t^2 - y^2) Sin[y];

RKStep[{t_,y_}] :=
( k1 = N[f[t,y]];
  k2 = N[f[t+0.5*h,y+0.5*h*k1]];
  k3 = N[f[t+0.5*h,y+0.5*h*k2]];
  k4 = N[f[t+h,y+h*k3]];
  N[{t+h,y+(h/6)*(k1+2*k2+2*k3+k4)}] )

h = 0.1;

soln1=NestList[RKStep,{0,1},10]

p1 = ListPlot[soln1,PlotJoined->True,
     PlotStyle->{RGBColor[0,1,0]}]

h = 0.05;

soln2=NestList[RKStep,{0,1},20]

p2 = ListPlot[soln2,PlotJoined->True,
     PlotStyle->{RGBColor[0,0,1]}]

h = 0.025;

soln3=NestList[RKStep,{0,1},40]

The value of y[1] for each of these approximations and for the output of NDSolve[] is within ±0.000001 of 0.766013.

p3 = ListPlot[soln3,PlotJoined->True,
     PlotStyle->{RGBColor[1,0,0]}]

Show[p1,p2,p3,p]

The plots are almost identical as well.