Slope Fields - Uplift Education

advertisement
1
Derivation of Euler's Method - Numerical Methods for Solving Differential Equations
Let’s start with a general first order Initial Value Problem
𝑑𝑦
= 𝑓(π‘₯, 𝑦)
𝑦(π‘₯0 ) = 𝑦0
(1)
𝑑π‘₯
where f(x, y) is a known function and the values in the initial condition are also known numbers. If f is continuous
functions then there is a unique solution to the IVP in some interval surrounding x = x0 .
So, let’s assume that everything is nice and continuous so that we know that a solution will in fact exist.
We want to approximate the solution to (1) near x = x0 :
1. point (x0, y0) an exact value, known to lie on the solution curve
tangent line to the ghost (unknown) solution y = f(x) at x = x0 : 𝑦 = 𝑦0 + 𝑓′(π‘₯0 , 𝑦0 )(π‘₯ − π‘₯0 )
If x1 is close enough to x0 then the point y1 on the tangent
line should be fairly close to the actual value
of the solution at x1, or y(x1).
2. point (x1, y1) 𝑦1 = 𝑦0 + 𝑓(π‘₯0 , 𝑦0 )(π‘₯1 − π‘₯0 )
an approximate value of f(x1) , lying on tangent line
through (xo, yo).
If we want other points along the path of the true
solution, and yet we don't actually have the true
solution, then it looks like using the tangent line as an
approximation might be our best bet! After all, at
least on this picture, it looks like the line stays pretty close to the curve if you don't move too far away from
the initial point.
We must now attempt to continue our quest for points on the solution curve (though we're starting to see
the word "on" as a little optimistic—perhaps "near" would be a more realistic word here.). So in hope that
we are going in the right direction we will construct pseudo-tangent line (pseudo: because it is not on the
actual solution). We will substitute our new point, (x1, y1), into the formula:
slope of the solution = f (x,y)
to get the slope of a pseudo-tangent line to the curve at (x1,y1). We hope that our approximate point, (x1,y1),
is close enough to the real solution that the pseudo-tangent line is pretty close to the unknown real tangent
line. Pattern for generating new points was established
3. point (x2, y2)
𝑦2 = 𝑦1 + 𝑓(π‘₯1 , 𝑦1 )(π‘₯2 − π‘₯1 ) an approximate value, lying on tangent line through (x1, y1).
𝑦 = 𝑦1 + 𝑓(π‘₯1 , 𝑦1 )(π‘₯ − π‘₯1 )
4. point (x3, y3)
𝑦3 = 𝑦2 + 𝑓(π‘₯2 , 𝑦2 )(π‘₯3 − π‘₯2 ) an approximate value, lying on tangent line through (x2,y2).
𝑦 = 𝑦2 + 𝑓(π‘₯2 , 𝑦2 )(π‘₯ − π‘₯2 )
𝑦 = 𝑦0 + 𝑓(π‘₯0 , 𝑦0 )(π‘₯ − π‘₯0 )
𝑦 = 𝑦1 + 𝑓(π‘₯1 , 𝑦1 )(π‘₯ − π‘₯1 )
𝑦 = 𝑦2 + 𝑓(π‘₯2 , 𝑦2 )(π‘₯ − π‘₯2 )
𝑦 = 𝑦3 + 𝑓(π‘₯3 , 𝑦3 )(π‘₯ − π‘₯3 )
Assuming that the step sizes are of uniform size:
π‘₯𝑛+1 − π‘₯𝑛 = β„Ž
recursive formula for approximate points is:
𝒙𝒏+𝟏 = 𝒙𝒏 + 𝒉
π’šπ’+𝟏 = π’šπ’ + 𝒇𝒏 𝒉
𝑓𝑛 = 𝑓(π‘₯𝑛 , 𝑦𝑛 )
2
Example
Solve the initial value problem: y′ = x + 2y,
1, and using steps of size h = 0.25.
y(0) = 0 numerically (Euler), finding a value for the solution at x =
xn+1 = xn + h
yn+1 = yn + h f(xn, yn)
1. point (0,0)
2. point (0.25, 0)
x1 = xo + h = 0.25
y1 = yo + h f(xo, yo) = yo + h (xo + 2yo) = 0 + 0.25 (0 + 2*0) = 0
3. point (0.5, 0.0625)
x2 = x1 + h = 0.5
y2 = y1 + h f (x1, y1) = y1 + h (x1 + 2y1) = 0 + 0.25 (0.25 + 2*0) = 0.0625
4. point (0.75, 0.21875)
x3 = x2 + h = 0.75
y3 = y2 + h f (x2, y2) = y2 + h (x2 + 2y2) = 0.0625+0.25 (0.5+2*0.0625) = 0.21875
5. point (1, 0.515625)
x4 = x3 + h = 1
y4 = y3 + h f (x3, y3) = y3 + h (x3 + 2y3)= 0.21875+0.25 (0.75+2*0.21875) = 0.515625
How accurate is this solution: NOT VERY!!!
Analytically: y′ = x + 2y,
𝑑𝑦
𝑑π‘₯
𝑑𝑦
𝑑π‘₯
y(0) = 0
linear differential equation of order 1:
+ 𝑃(π‘₯)𝑦 = 𝑄(π‘₯) →
𝑦 𝑒∫ 𝑃𝑑π‘₯ = ∫ 𝑄𝑒∫ 𝑃𝑑π‘₯ 𝑑π‘₯ + 𝐢
− 2𝑦 = π‘₯
𝑦 𝑒∫ −2𝑑π‘₯ = ∫ π‘₯𝑒∫ −2𝑑π‘₯ 𝑑π‘₯ + 𝐢 → 𝑦 𝑒−2π‘₯ = ∫ π‘₯ 𝑒−2π‘₯ + 𝐢
→
1
1
1
𝑦 𝑒 −2π‘₯ = 𝑒 −2π‘₯ (−2π‘₯ − 1) + 𝐢 → 𝑦 = (−2π‘₯ − 1) + 𝐢𝑒 2π‘₯ & 𝑦(0) = 0 → 𝐢 =
4
4
4
𝑦 =
1 2π‘₯ 1
𝑒 + (−2π‘₯ − 1)
4
4
Comparison of analytical (blue) and numerical solutions (red) with steps 0.25 and 0.02.
The numerical solution gets worse and worse as we move further to the right, and becomes more accurate with the
smaller steps. This method is one that truly belongs on a computer!
3
Slope Fields
Purpose: To graphically express a differential equation using slope fields.
Slope fields are a way to visualize a differential equation. It is simply a graph that shows the
slopes at points on the coordinate plane for a differential equation.
First a little review:
𝑦 = π‘₯2 + 3
πΆπ‘œπ‘›π‘ π‘–π‘‘π‘’π‘Ÿ:
𝑦 = π‘₯2 − 5
or
π‘‘β„Žπ‘’π‘›:
𝑦′ = 2π‘₯
𝑦′ = 2π‘₯
It doesn’t matter whether the constant was 3 or -5, since when we take the derivative the constant disappears.
However, when we try to reverse the operation:
𝐺𝑖𝑣𝑒𝑛:
𝑦′ = 2π‘₯
𝑓𝑖𝑛𝑑 𝑦
𝑦 = π‘₯2 + 𝐢
We don’t know what the constant is, so
we put “C” in the answer to remind us
that there might have been a constant.
If we have some more information
we can find C.
𝐺𝑖𝑣𝑒𝑛:
𝑦
4
𝐢
𝑦
𝑦′ = 2π‘₯
= π‘₯2 + 𝐢
= 1+𝐢
=3
= π‘₯2 + 3
π‘Žπ‘›π‘‘ 𝑦 = 4
π‘€β„Žπ‘’π‘› π‘₯ = 1 , 𝑓𝑖𝑛𝑑 π‘‘β„Žπ‘’ π‘’π‘žπ‘’π‘Žπ‘‘π‘–π‘œπ‘› π‘“π‘œπ‘Ÿ 𝑦.
This is called an initial value problem.
We need the initial values to find the
constant.
An equation containing a derivative is called a differential equation. It becomes an initial value problem when you
are given the initial condition and are asked to find the original equation.
Initial value problems and differential equations can be illustrated with a slope field.
Slope fields are mostly used as a learning tool and are mostly done on a computer or graphing calculator, but an AP
student could be asked to draw a simple one by hand.
draw a segment
with a slope of 0
draw a segment
with a slope of 2
draw a segment
with a slope of 4
4
𝑦′ = 2π‘₯
If you know an initial condition, such as (1,-2),
you can sketch the curve.
By following the slope field, you get a rough picture of what
the curve looks like.
In this case, it is a parabola.
𝑦 = π‘₯2 + 𝐢
𝑖𝑠 π‘‘β„Žπ‘’ π‘“π‘Žπ‘šπ‘–π‘™π‘¦ π‘œπ‘“ π‘ π‘œπ‘™π‘’π‘‘π‘–π‘œπ‘›π‘ 
𝑦 = π‘₯ 2 − 3 𝑖𝑠 π‘‘β„Žπ‘’ π‘π‘Žπ‘Ÿπ‘‘π‘–π‘π‘’π‘™π‘Žπ‘Ÿ π‘ π‘œπ‘’π‘™π‘’π‘‘π‘–π‘œπ‘›
𝐸π‘₯π‘Žπ‘šπ‘π‘™π‘’:
𝑑𝑦
𝑑π‘₯
= π‘₯𝑦
1
𝑦(0) = 2
Only special types of differential equations can be
solved analytically. In that case we don’t need
neither Euler’s method nor slope field.
Just for practice we chose the one that can be solved
analytically:
𝑑𝑦
= π‘₯ 𝑑π‘₯
𝑦
don’t panic
this is experience
→
𝑙𝑛 𝑦 =
π‘₯2
+ 𝑙𝑛 𝐢
2
π‘₯2
𝑦
π‘₯2
𝑙𝑛 =
→ 𝑦 = 𝐢𝑒 2
𝐢
2
1
1
π‘“π‘œπ‘Ÿ π‘–π‘›π‘–π‘‘π‘–π‘Žπ‘™ π‘π‘œπ‘›π‘‘π‘–π‘‘π‘–π‘œπ‘› 𝑦(0) = 2 , 𝐢 = 2
π‘π‘Žπ‘Ÿπ‘‘π‘–π‘π‘’π‘™π‘Žπ‘Ÿ π‘ π‘œπ‘™π‘’π‘‘π‘–π‘œπ‘›: 𝑦 =
1 π‘₯2
𝑒 2
2
The particular (specific) solution, for the initial condition (0,½), has been superimposed as the
solid line on the field. Notice how the field’s lines match up with the solution’s curve. This is
why slope fields are useful: they can show the shapes of the possible solutions (just follow the
and connect the slope lines), as well as predict other values on the solution. Even though most
graphing calculators can plot slope fields, you should know how to make them by hand. The AP
test requires that you be able to identify what the slope field of a function looks like, without a
graphing calculator. Making a slope field involves evaluating the differential equation at each
point.
5
𝐸π‘₯π‘Žπ‘šπ‘π‘™π‘’: π·π‘Ÿπ‘Žπ‘€ π‘‘β„Žπ‘’ π‘ π‘™π‘œπ‘π‘’ 𝑓𝑖𝑒𝑙𝑑 π‘“π‘œπ‘Ÿ π‘‘π‘–π‘“π‘’π‘Ÿπ‘’π‘›π‘‘π‘–π‘Žπ‘™ π‘’π‘žπ‘’π‘Žπ‘‘π‘–π‘œπ‘›:
𝑑𝑦
= π‘₯𝑦 2
𝑑π‘₯
Solution: Start off by making some observations about what the field should look like:
• On the axes, the slope is zero.
• Farther from the origin, the slopes are larger.
• In first and fourth quadrants, the slopes are positive.
• In the second and third quadrants, the slopes are negative.
Making observations like this will help you identify a slope field for a function.
Next, make a table of slope values, but for simpler functions like the one given, this can
usually be done in your head. Only a few slope values are shown here:
Now, you are ready to graph the field. Draw a short line segment with the
slope you calculated above for each of the points. The field should look
something like this:
Example: Match the following differential equations with their respective slope fields.
𝑑𝑦
𝑑𝑦
𝑑𝑦
𝑑𝑦
π‘Ž)
=π‘₯+𝑦
𝑏)
= π‘₯ − 𝑦2
𝑐)
= π‘₯(1 − 𝑦)
𝑑)
= −π‘₯√𝑦
𝑑π‘₯
𝑑π‘₯
𝑑π‘₯
𝑑π‘₯
Solution:
Since graph (3) is the only graph that does not exist below the x-axis, therefore, it must go with equation (d), which
has the square root. Graph (1) appears to have zero slope at y = 1, and at x = 0. The only equation to meet these
criteria is equation (c). Graph (2) appears to have zero slope along a diagonal y = −x. Equation (a) meets the
criterion in this case. The only one left is graph (4) and equation (b), which makes sense because the graph seems to
have zero slope along y = ± √π‘₯. The answers are 1c, 2a, 3d, 4b.
6
Example: 1. Sketch the slope field for the differential equation:
𝑑𝑦
= 0.25(𝑦 − 1)(5 − 𝑦)
𝑑π‘₯
2a. Describe (draw) the particular solution with the initial condition y(0)=6
2b. Describe (draw) the particular solution with the initial condition y(0)=5
2c. Describe (draw) the particular solution with the initial condition y(0)=3
2d. Describe (draw) the particular solution with the initial condition y(0)=1
2e. Describe (draw) the particular solution with the initial condition y(0)=0
1.
2a,c.
2b,d.
2e.
7
SOLUTIONS:
1
2a. starting at the point (0, 6) will
go down toward the line y = 5.
2b. The trajectory starting at
the point (0, 5)will stay
along the line y = 5
2d. The trajectory starting at the point (0, 1)
will stay along the line y = 1
2c. The trajectory starting at
at the point (0, 3) will go up
toward the line y = 5
2e. The trajectory starting at the point (0, 0)
will go down toward – ∞
Download