Using Euler`s tangent line method to approximate solutions

advertisement
Using Euler’s tangent line method to approximate solutions
The idea is: If you are given an initial value problem such as
dy
 f (t , y ), y (t 0 )  y 0 ,
dt
f
are continuous in some rectangle about (t 0 , y0 ) , i.e. you know that
y
dy
 f (t 0 , y 0 ) is the slope of the
there is a possible solution y   (t ) , then note that
dt t0
and if both f and
tangent to the graph of y   (t ) at the point (t 0 , y0 ) . Let us write the equation of the
tangent to y   (t ) at (t 0 , y0 ) . The equation of the tangent is y  y0  f (t 0 , y0 )(t  t 0 ) .
This equation can be written as: y  y0  f (t 0 , y0 )(t  t 0 ) ………(1).
In the absence of a clear-cut analytic formula for y   (t ) we can say that all right
y   (t ) passes through (t 0 , y0 ) so if there is a point t1 very close to t 0 on the t-axis then
let us use the equation (1) of the tangent at (t 0 , y0 ) to approximate the value of  (t ) at t1 .
(After all, a tangent touches the curve and so must be very close to it near the point of
tangency!) So we say that  (t1 )  y1  y0  f (t 0 , y0 )(t1  t 0 ) .
Let us take an example for clarity so that we can make appropriate pictures. I choose the
dy
 3  e t  12 y , y (0)  1 . The equation of
example given in your book (on page 98):
dt
the tangent at the point (0,1) is y  1  3.5(t  t 0 ) . I like this example because the authors
have appropriately taken a differential equation whose analytic solution

t
y   (t )  6  2e t  3e 2 can be easily found. The graphs of the exact solutions and the
tangent are given below: The red line is y   (t ) and the green one is the tangent at
(0,1).
You may note that at t=0.1 the graph of the curve is almost indistinguishable from that of
the tangent, while at t=0.3 the difference between y(.3) (on the tangent) and  (.3) (on the
curve) is appreciable. But we are dealing with lines here, which have no thickness, so rest
assured that there is indeed some difference between y(.1) (on the tangent) and  (.1) . To
make a clearer picture we take t1 =.3. We note that on the tangent y(.3)=2.05 which is
clearly greater than y   (.3)  1.936 . Now if we approximate y   (t ) by y(.3)=2.05
then we are on the solution of the initial value problem:
dy
 3  e t  12 y , y (.3)  2.05 . Now we have the following picture, including the
dt
necessary Maple computations and plot commands:
> dsolve({diff(y(t),t)=3+exp(-t)-.5*y(t),y(.3)=2.05},y(t));
 -3  

 
(  1/2 t )  79
10 
  2 e   
e
( t )
 20

y( t )62 e 
-3
e
> evalf(%);
>
y( t )6.2. e
( 1. t )
 
 
 20
2.867829306 e
( .5000000000
t)
> plot({6-2*exp(-t)-2.87*exp(-t/2),6-2*exp(-t)-3*exp(t/2),1+(3.5)*t},t=-.1..3,y=0..5);
Here the green line is the solution to the original initial value problem red line is the
dy
 3  e t  12 y , y (.3)  2.05 and the tangent at (0,1) to
solution to the IV problem
dt
the actual solution to the original solution is sort of yellow. But have you noticed? We set
dy
 3  e t  12 y , y (0)  1 , used the tangent method to
out to find the solution of
dt
approximate the solution at t=.3 and now we are stuck with the initial value problem
dy
 3  e t  12 y , y (.3)  2.05 . We can use the tangent at (0.3, 2.05) to approximate
dt
the value of the solution to this new IV problem at t=.6 and take it as an approximate
value for  (.6) and repeating the whole procedure over and over again we can make a
sequence of approximations for  (.9) ,  (1.2) , etc. With the choice of the step size = .3
we may wander away from the exact solution but we know that had we taken step size =
0.1, we would not be too far from the actual value. Let us then go back to the generalities
to fix the method.
dy
 f (t , y ), y (t 0 )  y 0 .
We had the initial value problem:
dt
We used the tangent y  y0  f (t 0 , y0 )(t  t 0 ) at (t 0 , y0 ) to approximate  (t1 ) as
y1  y0  f (t 0 , y0 )(t1  t 0 ) . We got stuck at the initial value problem
dy
 f (t , y ), y (t1 )  y1 so we decided to use the tangent method all over again and the
dt
equation of the tangent at (t1 , y1 ) is y  y1  f (t1 , y1 )(t  t1 ) . Now we can use this
tangent to approximate  (t 2 ) as y2  y1  f (t1 , y1 )(t 2  t1 ) . We can proceed similarly
and have a whole sequence of approximations:
 (t 3 ) as y3  y 2  f (t 2 , y 2 )(t 3  t 2 )
 (t 4 ) as y 4  y3  f (t 3 , y3 )(t 4  t 3 ) and generally
 (t k 1 ) as y k 1  y k  f (t k , y k )(t k 1  t k ) where we assume that
y k and f (t k , y k ) have been computed before. Life will be easier if we assume that
t 0 , t1 , t 2 ,...t k , t k 1 ... is an increasing sequence of numbers and that t k 1  t k  h a
constant. Then we can approximate  (t k 1 ) as y k 1  y k  f (t k , y k )h
This gives us the following tabular procedure (let’s say for our favorite initial value
dy
 3  e t  12 y , y (0)  1 with h=0.1):
problem
dt
t
y(t)
f(t, y(t))= 3  e t  12 y (t )
t 0 =0
y(t 0 ) =1
f (t 0 , y(t 0 )) =3.5
y(t1 )  1  (3.5)(.1) =1.35
f (t1 , y(t1 ))  3  e .1  12 y (.1) =3.2298
- - ---- --t 2 =.2
Proceeding in this fashion making new approximations using previous approximations
we produce a whole sequence of approximate points for the graph of y   (t ) which can
be plotted to get an idea of the solution. Excel is very well suited for this kind of
computations. The attached Excel file would give you the idea of how to do those
approximations quickly and efficiently. In Excel only two columns are necessary thanks
to the facility of writing formulas. I have used the third column to give the corresponding
values of the exact solution.
t1 =0.1
Download