In[9]:=

Needs["Graphics`PlotField`"]

In[10]:=

Needs["Graphics`Colors`"]

First Order Linear ODEs

Example 1

In[11]:=

vfplot = PlotVectorField[{1, Exp[-2t] + y}, {t, -1, 1}, {y, -2, 6}, ColorFunctionHue, DisplayFunctionIdentity] ;

In[12]:=

RowBox[{RowBox[{solns, =, RowBox[{Flatten, [, RowBox[{Table, [, RowBox[{y[t]/.DSolve[{y '[t] & ... , y[0] k}, y[t], t], ,, RowBox[{{, RowBox[{k, ,, 0, ,, 2, ,, 0.5}], }}]}], ]}], ]}]}], ;}]

In[13]:=

splot = Plot[Evaluate[solns], {t, -1, 1}, DisplayFunctionIdentity] ;

In[14]:=

RowBox[{RowBox[{ics, =, RowBox[{Graphics, [, RowBox[{Join, [, RowBox[{{Black, PointSize[1/50]} ... owBox[{Point[{0, k}], ,, RowBox[{{, RowBox[{k, ,, 0, ,, 2, ,, 0.5}], }}]}], ]}]}], ]}], ]}]}], ;}]

The plot below shows many solutions to the ODE: y'=^(-2t) + y. Each solution curve corresponds to a different initial condition. The initial conditions are represented by the "dots" in the graph. The vector field is also shown. Every vector field "arrow" is tangent to the solution curve that would passs through that point in the ty-plane.

In[15]:=

Show[vfplot, splot, ics, DisplayFunction$DisplayFunction, AxesTrue, AxesLabel {"t", "y"}, AspectRatio1]

[Graphics:HTMLFiles/index_9.gif]

Out[15]=

⁃Graphics⁃

Example 2

In[16]:=

vfplot = PlotVectorField[{1, 3t y + t}, {t, -1, 1}, {y, -4, 4}, ColorFunctionHue, DisplayFunctionIdentity] ;

In[17]:=

RowBox[{RowBox[{solns, =, RowBox[{Flatten, [, RowBox[{Table, [, RowBox[{y[t]/.DSolve[{y '[t] & ...  y[0] k}, y[t], t], ,, RowBox[{{, RowBox[{k, ,, -1, ,, 1, ,, 0.5}], }}]}], ]}], ]}]}], ;}]

In[18]:=

splot = Plot[Evaluate[solns], {t, -1, 1}, DisplayFunctionIdentity] ;

In[19]:=

RowBox[{RowBox[{ics, =, RowBox[{Graphics, [, RowBox[{Join, [, RowBox[{{Black, PointSize[1/50]} ... wBox[{Point[{0, k}], ,, RowBox[{{, RowBox[{k, ,, -1, ,, 1, ,, 0.5}], }}]}], ]}]}], ]}], ]}]}], ;}]

In[20]:=

isoplot = Plot[-1/3, {t, -1, 1}, PlotStyle {Thickness[1/100], Gray}, DisplayFunctionIdentity] ;

The plot below shows many solutions to the ODE: y'=3ty + t. Each solution curve corresponds to a different initial condition. The initial conditions are represented by the "dots" in the graph. The vector field is also shown. Every vector field "arrow" is tangent to the solution curve that would passs through that point in the ty-plane. The vertical line through t=0 is called an isocline. Isoclines are curves in the ty-plane along which y'=0. There is another isocline, namely the horizontal line y=-1/3.

In[21]:=

Show[vfplot, splot, ics, isoplot, DisplayFunction$DisplayFunction, AxesTrue, AxesLabel {"t", "y"}, AspectRatio1, PlotRange {-4, 4}]

[Graphics:HTMLFiles/index_18.gif]

Out[21]=

⁃Graphics⁃

In the plot below we see the same information as above with the additional shading of the xy-plane. The shading is chosen to represent the general behavior of solutions in each part of the plane. We note that in the upper left portion and lower right portion of the plane, the background is gray. This is chosen because in these two regions, y'<0. What can be said about y' in the other two (unshaded) regions of the plane?

In[22]:=

VisualDSolve[y '[x] 3x y[x] + x, {x, -1, 2}, {y, -1, 1}, DirectionFieldTrue, A ... 54;True, IsoclinePlotPoints50, IsoclineShadingTrue, ShowInitialValuesTrue]

Out[22]=

VisualDSolve[y^′[x] x + 3 x y[x], {x, -1, 2}, {y, -1, 1}, DirectionField ... 54;True, IsoclinePlotPoints50, IsoclineShadingTrue, ShowInitialValuesTrue]

Example 3

In[23]:=

vfplot = PlotVectorField[{1, Cos[t] - y/t}, {t, -π/4, 3π/2}, {y, -4, 1}, ColorFunctionHue, DisplayFunctionIdentity] ;

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

General :: stop : Further output of Power :: infy will be suppressed during this calculation. More…

In[24]:=

solns = Flatten[Table[y[t]/.DSolve[{y '[t] Cos[t] - y[t]/t, y[j] k}, y[t], t], {j, π/4, 3π/2, π/4}, {k, -4, 0, 2}]] ;

In[25]:=

splot = Plot[Evaluate[solns], {t, -π/4, 3π/2}, DisplayFunctionIdentity] ;

In[26]:=

ics = Graphics[Join[{Black, PointSize[1/50]}, Table[Point[{π/4, k}], {k, -4, 0, 2}], Tabl ...  0, 2}], Table[Point[{π, k}], {k, -4, 0, 2}], Table[Point[{3π/2, k}], {k, -4, 0, 2}]]] ;

In[27]:=

isoplot = Plot[t Cos[t], {t, -π/4, 3π/2}, PlotStyle {Thickness[1/100], Gray}, DisplayFunctionIdentity] ;

The plot below shows many solutions to the ODE: y'=cos t - y/t. Each solution curve corresponds to a different initial condition. The initial conditions are represented by the "dots" in the graph. The vector field is also shown. Every vector field "arrow" is tangent to the solution curve that would passs through that point in the ty-plane. This time we see the isocline as a thicker gray line.

In[28]:=

Show[vfplot, splot, ics, isoplot, DisplayFunction$DisplayFunction, AxesTrue, A ... ", "y"}, AspectRatio1, PlotRange {{-π/4, 3π/2}, {-4, 1}}]

[Graphics:HTMLFiles/index_33.gif]

Out[28]=

⁃Graphics⁃


Created by Mathematica  (August 29, 2003)