Applications to Mechanics and Euler`s Method

advertisement
Applications to Mechanics and Euler’s Method
We develop a few more models, starting by developing a more complete model of a
falling object which includes air resistance. We will also consider methods of estimating the solution to an initial value problem.
1. Modeling: Falling Objects
2. Discontinuous Coefficients
3. Distance as a Variable
4. Euler’s Method
1
An Application: Falling Objects
Remember the example we solved earlier (in Lesson 1):
A ball is thrown upward from 6 feet with an initial velocity of 20 ft/sec.
Model the height s(t) the ball is after t seconds.
We used the differential equation s′′ = −32, with initial conditions
s(0) = 6 and s′ (0) = 20. We could solve this by two integrations, first
finding s′ then s. (Note that this equation is separable; this is what
allowed us to solve the equation by integrating on both sides.)
After solving for initial conditions, we got s(t) = −16t2 + 20t + 6.
The max height is reached when v(t) = 0.
The ball hits the ground when s(t) = 0.
This early example was straightforward, but somewhat incomplete. We now attempt
to include air resistance in our model. We make the assumption (based on observation) that air resistance is proportional to the magnitude of the velocity. To correctly
deal with the forces involved, we will add the information that the ball weighs 3/4 lb.
Example:
A ball weighing 3/4 lb is thrown upward from 6 feet with an initial velocity of 20 ft/sec.
Find a model for the height s(t) at time t, taking air resistance into account. Find
1
the time at which the ball is expected to hit the ground.
The forces acting on the ball are:
• gravitational force, mg, with ball mass 3/4 lb, and
• air resistance, with force ks′ where k is a constant determined experimentally.
We will use k = 1/64 for convenience.
So the differential equation is given by Newton’s second law, ma = F :
ms′′ = −mg − ks′
(Note that the air resistance always acts in the direction opposite the velocity.)
Since the acceleration due to gravity is about 32 ft/s2 , we have 3/4 = 32m, or
m = 3/128 slugs. (A slug is a unit of mass in the British system.) Thus, dividing
through by mass and plugging in k = 1/64 yields
s′′ = −32 − 2/3s′
This is easy to solve by first using an integrating factor:
2
s′′ + s′ = −32
3
′ 2/3t ′
se
= −32e2/3t
s′ = −48 + Ce−2/3t
We can go ahead and plug in the initial condition s′ (0) = 20 to get C = 68. Then
one more integration and we’re done. (Note that the new equation is separable!)
s = −48t − 102e−2/3t + C
Finally, the fact that s(0) = 6 allows us to determine −102 + C = 6, so C = 108. So
the solution (the position function) is
s(t) = −48t − 102e−2/3t + 108
To determine the maximum height, find when s′ (t) is zero:
s′ (t) = −48 + 68e−2/3t = 0
48/68 = e−2/3t
Which gives t ≈ 0.52, so max height is s(0.52).
To determine when it hits the ground, we need to find where s(t) = 0. A plot indicates
the t value is near 1.4:
14
-48*x - 102*exp(-2*x/3) + 108
12
10
8
6
4
2
0
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Figure 1: Graph of position at time t (s(t) = −48t − 102e−2/3t + 108)
(Notice that if we ignore air resistance and used s(t) = −16t2 + 20t + 6, we would
get s(t) = 0 at t = 1.5. It is not surprising that the addition of air resistance has not
greatly changed this answer in this example.)
Using Matlab (>> fzero(’-48*x-102*exp(-2/3*x)+108’, 1.4)) yields an answer
of 1.432.
Notice that when t → ∞, s′ (t) = −mg/k = −48. This is called the terminal velocity.
Here’s another modeling problem to try. It’s similar to the problem above, but adds
a new wrinkle.
Example:
A skydiver weighing 60 kg falls from a plane (i.e., initial velocity is zero.) His
parachute opens after five seconds. If the force of air resistance is ten times his
velocity before opening the parachute, and 100 times his velocity after opening the
parachute, determine
1. his velocity when the parachute opens;
2. the velocity function v(t) after the parachute opens; and
3. his limiting velocity both with and without the parachute.
2
Discontinuous Coefficients
It is possible to solve some differential equations with discontinuous coefficients, such
as step functions. The general procedure is to solve the equation with two different
sets of coefficients, then paste the results together to make the resulting function
continuous.
Example:
Solve the initial value problem y ′ − y = g(t), and y(0) = 2, where
g(t) =
(
0 t≤1
2 t>1
We solve two different initial value problems, names y ′ − y = 0 and y ′ − y = 2
corresponding to the two different values of g:
y′ − y = 0
y′ − y = 2
′
′
[ye−t] = 0
[ye−t ] = 2e−t
ye−t = C0
ye−t = −2e−t + C1
y = C0 et
y = −2 + C1 et
Now we need to solve for the C0 and C1 . (Note that in this case we have two different
constants, as we are trying to solve two different initial value problems.)
Initially, we have g(t) = 0, so we have y(0) = 2, which means
y(t) = C0 e0 = 2,
so C0 = 2.
Therefore, for 0 ≤ t ≤ 1, we have solution y(t) = 2et .
Now we need to decide what initial condition to use for the second part of the function
where t > 1. We use the fact that at t = 1, we know y(1) = 2e, and use this as our
new initial condition:
y(1) = −2 + C1 e1 = 2e,
so C1 =
2(e + 1)
e
The entire point is to get a function which is continuous for all t. The final solution
is the piecewise defined function
y(t) =
(
2et
−2 +
2(e+1) t
e
e
t≤1
t>1
The graph of this function is shown below:
17.5
15
12.5
10
7.5
5
2.5
0.5
1
1.5
2
Note that the solution is continuous. The first derivative cannot be continuous however, since we have a discontinuity in the differential equation.
Now back to the sky diver problem; it can be considered a differential equation with
discontinuous coefficients, since the drag force was represented by the discontinuous
function:
(
−10s′ (t),
t < 5sec
f (t) =
′
−100s (t),
t ≥ 5sec
s′′ = −g − 10s′ /m
s′′ = −g − 100s′/m
s′′ = −9.81 − 10s′ /60
s′′ = −9.81 − 100s′ /60
s′ et/6 = (−9.81 ∗ 6)et/6 + C1
s′ e5t/3 = (−9.81 ∗ 3/5)e5t/3 + C2
s′ = (−9.81 ∗ 6) + C1 e−t/6
s′ (0) = 0, C1 = 58.8
s′ = −58.8 + 58.8e−t/6
s′ = (−9.81 ∗ 3/5) + C2 e−5t/3
s′ (5) = −58.8 + 58.8e−5/6 = −33.5
s′ (5) = (−9.81 ∗ 3/5) + C2 e−5∗5/3 = −33.5
s′ = −58.8 + 58.8e−t/6 , t ≤ 5
s′ = −5.88 − 114906e−5t/3 , t > 5
3
C2 = −114906
Distance as a Variable
In problems modeling motion (such as when we model a falling body), it is sometimes
convenient to consider position as the independent variable instead of time, when the
forces acting on the object are dependent on s and s′ , but not directly on t. In many
cases, the forces acting on an object may be dependent on position x(t) or the velocity
x′ (t) of the object at time t, but not directly on t. For example, a falling satellite is
affected by gravity (which depends on the distance from the Earth) and air resistance
(dependent in some way on velocity).
In these cases, it may be simpler to avoid time altogether and write the differential
equation based on distance travelled, which we will often denote x(t). We can do this
if we can treat time as a function of distance—which is legal as long as the object
is only moving one direction, and therefore does not end up at the same location at
two different times. If time is a function of position, then velocity is also a function
of position.
Then we can calculate dv/dt (the acceleration) in terms of dv/dx by using the chain
rule:
dv
dv dx
dv
=
=
v
dt
dx dt
dx
We can now write differential equations involving forces by using Newton’s second
law, F = ma, or
!
dv
,
F (x, v) = m v
dx
where F (x, v) is a function representing all forces which act on an object in terms of
its position and velocity.
Example:
We will consider a ballistics chamber designed to test projectiles. We will ignore
gravity and consider motion in a straight line. The resistive force in the chamber
will be proportional to the square of the velocity at each point. The chamber will be
designed so that the coefficient of the resistive force increases linearly with depth into
the chamber, so we say
k(x) = k0 x,
and the resistive force is then k(x)(x′ )2 or k0 x(x′ )2 . We will attempt to determine
what value of k0 must be used in our chamber to assure a reduction to 1% of the
entry velocity in d units of distance into the chamber.
Therefore, our initial value problem is given using the fact that F = ma, or −k0 xv 2 =
mx′′ (t). (The resistive force is the only force acting once the projectile enters the
chamber, and the acceleration must be negative.) Writing v = x′ , we get the equation
dv
.
dt
Since x is always increasing, we can consider v a function of x, so we can change to
variable x instead of t, using our usual transformation, dv/dt = (dx/dt)(dv/dx) =
vdv/dx:
dv
−k0 xv 2 = mv
dx
Now we separate variables and integrate:
−k0 xv 2 = m
1
k0 x
dv = −
dx
v
m
k0 x2
+C
ln |v| = −
2m
Since v ≥ 0, we have |v| = v, and we get the simplified equation
v = eC e−
k0 x 2
2m
.
2
0x
Using the initial condition v = v0 when x = 0, we get v = v0 exp − k2m
. (Recall
x
that we can write exp(x) for e .)
To make sure we are reduced to 1% of the initial velocity after d units into the
chamber, we solve for k0 as follows:
k 0 d2
.01v0 = v0 e− 2m
k0 d2
ln(.01) = −
2m
−
2m
ln(.01) = k0
d2
Of course we can also simplify since − ln(.01) = ln(100)
k0 =
2m
ln(100)
d2
is the required value for k0 .
In any case where we can view v as a function of x, we can rewrite a problem involving
dv
.
x′′ (t) terms of x using the relationships x′ = v and x′′ = v ′ = v dx
4
Euler’s Method
We will consider methods of estimating the solution to an initial value problem of the
form
y ′ = f (t, y),
y(t0) = y0
when we are unable to solve it explicitly.
Our approach to a solution will be to attempt to estimate the value y(t) at a variety
of points tn . We then have a table of values for the unknown function y.
Euler’s method is the most straightforward numerical method for estimating solutions
to an initial value problem. Suppose we are given the IVP
y ′ = f (t, y),
y(a) = y0
which we wish to solve on the interval [a, b]. We divide the interval up into n subintervals and n + 1 points a = t0 , t1 = t0 + h, t2 = t0 + 2h, . . . , tn = b, and proceed to
estimate the solution at each point.
Of course, y(a) = y0 by assumption. Note however that if we linearize the function
y(t), we see that
y(t0 + h) ≈ y(t0 ) + h y ′(t0 ).
But we know y ′(t0 )! Thus, we can estimate
y(t1 ) ≈ y(t0 ) + hy ′ (t0 ) = y(t0 ) + hf (t0 , y(t0)).
Then once we know y(t1 ), we can proceed to estimate y(t2 ) in the same way. In
general, at point y(ti ), we have
y(ti+1 ) = y(ti + h) ≈ y(ti) + hf (ti , y(ti )).
In other words, we approximate the next value by using the tangent line to predict
how y(t) will change.
Throughout the following, we will refer to our estimate of y at the ith point as yi .
Our initial value is y0 , and this value is actually known.
Example:
Suppose we attempt to estimate the solution to y ′ = y, y(0) = 1, on the interval [0, 5]
using Euler’s method. (We know of course that the solution is y(t) = et .)
Let’s try this with 6 points: 0, 1, 2, 3, 4, and 5. The distance between the points
(called the step size) is h = 1.
Now y(t0 ) = y(0) = 1 from the initial condition, so we have y0 = 1.
To find y1 , we calculate y1 = y0 + hf (t0 , y0). Now f (t, y) = y in this case, and h = 1,
so we get
y1 = y0 + h f (t0 , y0 ) = 1 + (1)(1) = 2.
Then to get y2 , we use the same method:
y2 = y1 + f (t1 , y1) = 2 + (1)(2) = 4.
The same technique leads to y3 = 8, y4 = 16, and y5 = 32. The general step which
we repeat is
yi+1 = yi + h f (ti , yi) = 2yi .
A plot of our Euler estimate (connected with straight line segments) next to the
actual solution ex is shown below:
150
exp(x)
Euler Approximation
100
50
0
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
We note that the original estimate is fairly good, but it becomes less accurate as we
move further from the initial condition. This can be improved by using a smaller step
size. For example, if we use h = .1, we get a total of 51 points from 0 to 5:
0, 0.1, 0.2, 0.3, . . . 4.8, 4.9, 5.0.
We can then use the same method, starting with y0 = 1 to get
y1 = y0 + hf (t0 , y0 ) = y0 + hy0 = 1 + (0.1)(1) = 1.1,
and then
y2 = y1 + hy1 = 1.1 + (0.1)(1.1) = 1.21,
and so forth. Continuing in this way gives the following picture when we connect the
51 points with straight line segments:
150
exp(x)
Euler Approximation
100
50
0
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
Let’s try again, with a different differential equation:
Example:
√
Estimate y(2) for y ′ = y + 2t, y(1) = 2 using stepsize h = 1 and again using stepsize
h = 0.5.
If we use stepsize h = 1, we need only one step. In general the step will be
√
yi+1 = yi + hf (ti , yi) = yi + (1)( yi + 2ti ).
√
(Here, the function f (t, y) = y + 2t.)
Thus, going from y0 = 2 to y1 we have
√
√
y1 = y0 + y0 + 2t0 = 2 + 2 + (2)(1) ≈ 5.4142.
Therefore, using h = 1, we have an approximation y(2) ≈ 5.4142.
5
4.5
4
3.5
3
2.5
2
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
Euler: x’ = sqrt(x) + 2*t, h = [1]
1.8
1.9
2
If we want to work with step size h = 0.5, we will need two steps, and our general
step will be
√
yi+1 = yi + hf (t, y) = yi + (0.5)( yi + 2ti ).
Thus, we have y0 = 2, and the rest are as follows:
√
√
y1 = y0 + (0.5)( y0 + 2t0 ) = 2 + (0.5)( 2 + 2) ≈ 3.7071
since t0 = 1, and
√
y2 = y1 + (0.5)( y1 + 2t1 )
√
≈ 3.7071 + (0.5)( 3.7071 + (2)(1.5)) ≈ 6.1698.
since t1 = 1.5.
6
5.5
5
4.5
4
3.5
3
2.5
2
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
Euler: x’ = sqrt(x) + 2*t, h = [0.5]
1.8
1.9
2
Thus, our estimate with h = 1 is y(1) ≈ 5.4142, and our estimate with h = 0.5 (and
thus two steps) is y(1) ≈ 4.4074. We do not know the actual solution in this case, so
we cannot compare to the correct solution, but in general a smaller step size should
give a more accurate result.
6.5
6
5.5
5
4.5
4
3.5
3
2.5
2
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
Euler: x’ = sqrt(x) + 2*t, h = [0.1]
1.8
1.9
2
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
Euler: x’ = sqrt(x) + 2*t, h = [0.01]
1.8
1.9
2
7
6.5
6
5.5
5
4.5
4
3.5
3
2.5
2
Euler’s method is a relatively simple method for approximating solutions to differential equations numerically. It is not generally used, however, because the method
takes too much work for too little of a result. Much more sophisticated algorithms
exist for approximating solutions to differential equations (these could be covered in
a different class). However, these methods are generally based on the ideas in Euler’s
method.
In some sense, approximating solutions to differential equations is analogous to approximating the value of an integral numerically. Left and right hand sums could be
used to approximate an integral, but are not very useful. However, more sophisticated methods (such as Simpson’s rule) are in some ways similar to using left and
right hand sums.
Download