Initializations

Example 2.4.15

Check solution to initial value problem:

DSolve[{y'[x]-y[x]^3==0,y[0]==y0},y[x],x]

Simplify[%]

Here is a plot of the solution for y0=1. Notice the solution is valid only for y < 1/2.

Plot[{(Sqrt[((y0^2)/(1-2 x (y0^2)))])/.y0->1,-(Sqrt[((y0^2)/(1-2 x (y0^2)))])/.y0->1},{x,-2,2}]

Here is what the solution looks like for y0 approaching zero.

Manipulate[Plot[{(Sqrt[((y0^2)/(1-2 x (y0^2)))]),-(Sqrt[((y0^2)/(1-2 x (y0^2)))])},{x,-2,2},PlotRange->{{-2,2},{-4,4}}],{y0,4,0}]

Example 2.4.20

Define the differential equation:

DE1 = y'[t]==t-1-y[t]^2

Plot the direction field:

field = VectorPlot[{1,Last[DE1]},{t,0,10},{y[t],-5,5},VectorScale->{Tiny,Small,None}]

From this sketch, it looks like there are two lines that the solutions approach for large values of t.

It is difficult to get an idea of what happens for large values of t from this plot; let's do another:

field2 = VectorPlot[{1,Last[DE1]},{t,18,20},{y[t],-2,2}, Axes->True,VectorScale->{Tiny,Small,None}]

From this plot, it looks like our solutions are increasing rapidly as  t->∞. This is incorrect. Let's try this again, but change some parameters until we can see some real behaviour patterns. This will take some experimentation on your part.

field2 = VectorPlot[{1,Last[DE1]},{t,0,15},{y[t],-10,10},VectorPoints->40,VectorScale->{Tiny,Small,None}]

It took a bit of experimenting, but it looks like our solutions either approach a (possibly) linear solution, or go off to minus infinity. We see that for 0<y(t=0)<∞ (roughly), the solution approaches the line around y=5. For y(t=0)<0 (again, only roughly estimating these values), the solution approaches minus infinity.

Let's use Mathematica to solve the differential equation:

sol=DSolve[DE1,y[t],t]

Wow! There are some funky functions going on here. This might be a complicated integral to solve by hand.

Here is how we can assign the solution to a variable, and create a list of functions from the family of curves which we can then plot:

y[t_]=y[t]/.First[sol]

functionlist=y[t]/.C[1]->Range[-1.5,1.5,0.2]

lines=Plot[Evaluate[functionlist],{t,0,15},PlotRange->{-10,10},AxesLabel->{"t","General Solutions"},PlotStyle->Red]

Here are the solution curves overlaid over the direction field:

Show[lines,field2,ImageSize->{600,Automatic}]

The straight lines look like horizontal asymptotes of our solution curves.

We can check the behaviour for large values of t:

Limit[y[t],t->Infinity]

We see that we determined the incorrect behaviour from the direction field above--the line is not a horizontal asymptote.

Obviously, to understand this differential equation more would require more time. It looks like it has an infinite value at a finite value of t.But we've learned alot already!

Example 2.2.24

y[t_,t0_]=If[t≥t0,(2/3(t-t0))^(3/2),0]

y[t_,t0_]=Piecewise[{{(2/3(t-t0))^(3/2),t≥t0},{0,t<t0}}]

For convenience I've left off the negative part of the solution.

Plot[y[t,1/2],{t,0,5},PlotRange->{{0,5},{0,5}},GridLines->{{2},{1}},AxesLabel->{"t","y"}]

Here is a plot for various t0, showing none going through the point (1,1).

functionlist=Table[y[t,t0],{t0,0,15,0.5}];
Plot[Evaluate[functionlist],{t,0,20},PlotRange->{{0,20},{0,5}},GridLines->{{1},{1}},ImageSize->{500,Automatic},AxesLabel->{"t","y"}]

Plot[{y[2,t0],-y[2,t0]},{t0,0,3},PlotRange->{{0,3},{-5,5}},GridLines->{None,{-(4/3)^(3/2),(4/3)^(3/2)}},ImageSize->{500,Automatic},AxesLabel->{"t0","y"}]

Example 2 From Text (Barry's Output for Homework--see the homework for a detailed discussion of this problem)

SetDirectory["C:\Documents and Settings\alpha\My Documents\Teaching\Differential Equations\Homework"]

Clear[y,t]

line=Graphics[Line[{{-2,0.7},{-2,-3.5},{1.2,-3.5},{1.2,0.7},{-2,0.7}}]];

dot=Graphics[Disk[{0,-1},{0.1,0.2}]];

plot1=Plot[1,{x,-2.5,2.5},PlotStyle->{Dashing[{0.02,0.02}]}]

Show[plot1,dot,line,Axes->True,PlotRange->{{-2.5,2.5},{-4,1.5}},AxesLabel->{"x","y"},AspectRatio->1/2,ImageSize->{400,Automatic}]

Export["figC2S4b.jpg",%,"JPEG"]

deq = y'[x] ==(3x^2+4x+2)/(2(y[x]-1))
field = VectorPlot[{1,Last[deq]},{x,-3,3},{y[x],-4,4},Frame->True,FrameLabel->{"x","y[x]"},VectorScale->{Tiny,Small,None}]

Solve[(Sqrt[4+2 x+2 (x^2)+(x^3)])==0,x]

Clear[y]
DSolve[deq,y[x],x]
DSolve[{deq,y[0]==-1},y[x],x]
DSolve[{deq,y[0]==1},y[x],x]

sol1=Plot[1-(Sqrt[4+2 x+2 (x^2)+(x^3)]),{x,-2,7},PlotStyle->{RGBColor[0,0,1],Dashing[{0.05,0.05}],Thickness[0.01]}]
sol2=Plot[{1-(Sqrt[2 x+2 (x^2)+(x^3)]),1+(Sqrt[2 x+2 (x^2)+(x^3)])},{x,0,2},PlotStyle->{{Red,Dashing[{0.02,0}],Thickness[0.01]},{Blue,Dashing[{0.02,0.02}],Thickness[0.01]}}]

Show[sol1,sol2,field,PlotRange->{{-3,3},{-4,4}},ImageSize->{500,500},AspectRatio->1,Frame->True,FrameLabel->{"x","y[x]"}]

Export["figC2S4c.jpg",%,"JPEG"]