next up previous contents
Next: First Order ODEs Numerically Up: Using hw3plot.m Previous: Using hw3plot.m   Contents

Example

Use hw3plot.m to create a slopefield, numerical plot, and plot of the symbolic solution to the ODE $x' \,=\, 2\,t\,x$.
  1. Separable equation

    \begin{eqnarray*}
\frac{1}{x} \,dx &=& 2t \,dx \; \Longrightarrow \;\int \frac{1...
...} \quad\mbox{(for $C \,=\, \pm C_2 \,=\,
\pm \mbox{e}^{C_1}$)}
\end{eqnarray*}



  2. ftx = `2*t*x';
    initax = [1,4,-2,0];
    t0 = 0; x0 = 0; C = 1;
    ftxsln = `C*exp(t$\wedge$2)';
  3. slopef(ftx,N) results in

    \begin{picture}(5,5.5)
\put(1,0){\includegraphics [width=5cm,height=5cm]{inst2f01.ps}}
\end{picture}



    Change initax = [-2,2,-2,2]; then slopef(ftx,N) results in

    \begin{picture}(5,5.5)
\put(1,0){\includegraphics [width=5cm,height=5cm]{inst2f02.ps}}
\end{picture}

  4. Running sol1 and placing pointer at about (1,1) results in

    \begin{picture}(5,5.5)
\put(1,0){\includegraphics [width=5cm,height=5cm]{inst2f03.ps}}
\end{picture}

  5. From the display we have t0 = 1.0932 and x0 = 0.95208 which we enter into init.m.
  6. Using $x \,=\, C \mbox{e}^{t^2}$, we solve $x_0 \,=\,
C \mbox{e}^{t_0^2}$; i.e.,

    \begin{eqnarray*}
t_0 &=& 1.0932, \; x_0 \;=\; 0.95208 \; \Longrightarrow \;0.95...
... \;\\ [1ex] C &=& 0.95208 \,\mbox{e}^{-1.0932^2}
\;=\; 0.28817
\end{eqnarray*}



    which we enter into init.m.
Completing Items 7-10, we obtain the finished product illustrated on the next page. (Note: your work in the upper left will be neatly hand written, not typed.)


\begin{picture}(15,22)
\par %% Use the following put to LaTeX and generate HTML...
...7\,\mbox{e}^{t^2} \end{array}$\renewedcommand{arraystretch}{1}
}}
\end{picture}


Michael Renardy
2000-05-12