Example 2.1.7

Draw a direction field for the differential equation:

((d y)/(d t))+2t y=2t exp(-(t^2)).

Based on the direction field, describe how the solutions behave for large values of t. Find the general solution of the given differential equation, and use it to determine how solutions behave as t->∞.

Solution

Clear[y,t]

Define the differential equation:

DE1 = y'[t]==-2t*y[t]+2t*Exp[-t^2]

We can select bits of a list or a quantity we've already defined using commands like Last and Part. For example, consider:

First[DE1]

Last[DE1]

This is what we need for the direction field. You could, of course, just type the quantity in yourself.

Plot the direction field:

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

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},VectorScale->{Tiny,Small,None}]

From this plot, it looks like our solutions are approaching zero as t->∞.

Let's use Mathematica to solve the differential equation; this will be a good check of our analytic solution.

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

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.

First, define the function (again, you could type this in by hand or copy and paste):

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

Now, let's get a list of functions that satisfy the DE for a variety of values of C[1]:

functionlist=y[t]/.C[1]->Range[-2,2,0.5]

Now, let's plot that list of functions:

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

Here are the solution curves overlaid over the direction field:

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

We can check the behaviour for large values of t:

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

We see that we determined the correct behaviour from the direction field above.

Example 2.1.18

Clear[y]

Integrate[t*Sin[t],t]

Check solution to differential equation:

DSolve[t*y'[t]+2y[t]==Sin[t],y[t],t]

Check solution to initial value problem:

DSolve[{t*y'[t]+2y[t]==Sin[t], y[Pi/2]==1},y[t],t]

Example 2.1.28

Check:

DSolve[{y'[t]+2y[t]/3==1-t/2,y[0]==y0},y[t],t]

Define the function:

y[t_]=Simplify[-(1/8) (E^(-2 t/3)) (21-21 (E^(2 t/3))+6 (E^(2 t/3)) t-8 y0)]

Solve the following equation for tb:

Solve[{y'[tb]==0},{tb}]

Substitute into the other equation

y[tb]/.tb->(3/2) Log[(4/3) ((7/4)-((2 y0)/3))]

Solve this equation for y0:

Solve[%==0,y0]

Now determine the second unknown, tb:

Simplify[(3/2) Log[(4/3) ((7/4)-((2 y0)/3))]/. y0->-(3/8) (-7+3 (E^(4/3)))]

Plot the solution for this value of y0 to verify (at least visually) that it touches but does not cross the t-axis:

Plot[y[t]/.y0->-(3/8) (-7+3 (E^(4/3))),{t,0,6}]