[email protected] MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 1 Bruce Mayer, PE Chabot...
-
Upload
april-long -
Category
Documents
-
view
224 -
download
0
Transcript of [email protected] MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 1 Bruce Mayer, PE Chabot...
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 1
Bruce Mayer, PE Chabot College Mathematics
Bruce Mayer, PELicensed Electrical & Mechanical Engineer
Chabot Mathematics
§9.4 ODEAnalytic
s
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 2
Bruce Mayer, PE Chabot College Mathematics
Review §
Any QUESTIONS About• §9.3 Differential Equation Applications
Any QUESTIONS About HomeWork• §9.3 → HW-15
9.3
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 3
Bruce Mayer, PE Chabot College Mathematics
§9.4 Learning Goals
Analyze solutions ofdifferential equationsusing slope fields
Use Euler’s methodfor approximating solutions of initialvalue problems
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 4
Bruce Mayer, PE Chabot College Mathematics
Slope Fields
Recall that indefinite integration, or AntiDifferentiation, is the process of reverting a function from its derivative. • In other words, if we have a derivative, the
AntiDerivative allows us to regain the function before it was differentiated – EXCEPT for the CONSTANT, of course.
Given the derivative dy/dx = f ‘(x) then solving for y (or f(x)), produces the General Solution of a Differential Eqn
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 5
Bruce Mayer, PE Chabot College Mathematics
Slope Fields
AntiDifferentiation (Separate Variables) Example• Let: • Then Separating the Variables:• Now take the AntiDerivative: • To Produce the General Solution:
This Method Produces an EXACT and SYMBOLIC Solution which is also called an ANALYTICAL Solution
xdx
dy2
dxxdy 2
dxxdy 2
Cxy 2
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 6
Bruce Mayer, PE Chabot College Mathematics
Slope Fields
Slope Fields, on the other hand, provide a Graphical Method for ODE Solution
Slope, or Direction, fields basically draw slopes at various CoOrdinates for differing values of C.
Example: The Slope Field for ODE x
dx
dy
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 7
Bruce Mayer, PE Chabot College Mathematics
Slope Fields
slope field describes several different parabolas based on varying values of C
Slope Field Example: create the slope field for the Ordinary Differential Eequation:
Cx
ydxxdyxdx
dy 2
12
y
x
dx
dy
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 8
Bruce Mayer, PE Chabot College Mathematics
Slope Fields
Note that dy/dx = x/y calculates the slope at any (x,y) CoOrdinate point• At (x,y) = (−2, 2),
dy/dx = −2/2 = −1• At (x,y) = (−2, 1),
dy/dx = −2/1 = −2• At (x,y) = (−2, 0),
dy/dx = −2/0 = UnDef.• And SoOn
Produces OutLine of a HYPERBOLA
x
y
-2
-1
1
2
-2 -1 1 2
x
y
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 9
Bruce Mayer, PE Chabot College Mathematics
Slope Fields
Of course this Variable Separable ODE can be easily solved analytically
y
x
dx
dy dxxdyy
dxxdyy
Cxy 22
2
1
2
1
Cxy 22
Cyx 22
x
y
-2
-1
1
2
-2 -1 1 2
x
y
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 10
Bruce Mayer, PE Chabot College Mathematics
Slope Fields Example
For the given slope field, sketch two approximate solutions – one of which is passes through(4,2):• Solve ODE Analytically using
using (4,2) BC
12 xm
2,4
12
1 x
dx
dy dxxdy
1
2
1
dxxdy
1
2
1
C 444
12 2
Cxxy 2
4
1
C 2 24
1 2 xxySoln
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 11
Bruce Mayer, PE Chabot College Mathematics
Slope Field Identification
C
3xdx
dy
In order to determine a slope field from a
differential equation, we should consider the
following:
i) If isoclines (points with the same slope) are along horizontal lines, then DE depends only on y
ii) Do you know a slope at a particular point?
iii) If we have the same slope along vertical lines, then DE depends only on x
iv) Is the slope field sinusoidal?
v) What x and y values make the slope 0, 1, or undefined?
vi) dy/dx = a(x ± y) has similar slopes along a diagonal.
vii) Can you solve the separable DE?
1. _____
2. _____
3. _____
4. _____
5. _____
6. _____
7. _____
8. _____
Match the correct DE with its graph:2y
dx
dy
xdx
dycos
xdx
dysin
yxdx
dy
22 yxdx
dy
1 yydx
dy
y
x
dx
dy
A B
C
E
G
D
F
H
H
B
F
D
G
E
A
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 12
Bruce Mayer, PE Chabot College Mathematics
Example Demand Slope Field
Imagine that the change in fraction of a production facility’s inventory that is demanded, D, each period is given by• Where p is the unit price in $k
Draw a slope field to approximate a solution assuming a half-stocked (50%) inventory and $2k per item, and then • Verify the Slope-Field solution using
Separation of Variables.
c
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 13
Bruce Mayer, PE Chabot College Mathematics
Example Demand Slope Field
SOLUTION: Calculate some
Slope Values from peDm
dp
dD 1
1100,0 0 emdp
dD
0111,1 1 emdp
dD
068.015.05.0,2 2 emdp
dD
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 14
Bruce Mayer, PE Chabot College Mathematics
Example Demand Slope Field
An approximate solution passing through (2,0.5) with slope field on the window 0 < x < 3 and 0 < y < 1
$k/unit p
fr
acti
onal
p
D
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 15
Bruce Mayer, PE Chabot College Mathematics
Example Demand Slope Field
Find an exact solution to this differential equation using separation of variables:
Remove absolute-value and then change signs as inventory demanded satisfies: 0≤ D ≤1
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 16
Bruce Mayer, PE Chabot College Mathematics
Example Demand Slope Field
Removing ABS Bars
Or Now use Boundary Value ($2k/unit,0.5)
CeCeDp eeDeeCeDpp
11ln 1ln
pp eeC eADDeeD 110with 1
572.05.02
eeA
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 17
Bruce Mayer, PE Chabot College Mathematics
Example Demand Slope Field
Graph for
This is VERY SIMILAR to the Slope Field Graph Sketched Before
peepD 572.01
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 18
Bruce Mayer, PE Chabot College Mathematics
Numerical ODE Solutions Next We’ll “look
under the hood” of NUMERICAL Solutions to ODE’s
The BASIC Game-Plan for even the most Sophisticated Solvers:• Given a STARTING
POINT, y(0)• Use ODE to find dy/dt at t=0
• ESTIMATE y1 as
001
tdt
dytyy
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 19
Bruce Mayer, PE Chabot College Mathematics
Numerical Solution - 1
Notation Exact Numerical Method (impossible to achieve) by Forward Steps
tntn
)( nn tyy
),( nnn ytff
Number Step n
Length Step Time t
),( ytfdt
dy
Now Consider
yn+1
tn
yn
tn+1
t
Dt
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 20
Bruce Mayer, PE Chabot College Mathematics
Numerical Solution - 2 The diagram at Left shows
that the relationship between yn, yn+1 and the CHORD slope
yn+1
tn
yn
tn+1
t
Dt
slope chord 1
t
yy nn
The problem with this formula is we canNOT calculate the CHORD slope exactly • We Know Only Δt & yn, but
NOT the NEXT Step yn+1
The AnalystChooses Δt
ChordSlope
Tangent Slope
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 21
Bruce Mayer, PE Chabot College Mathematics
Numerical Solution -3 However, we can
calculate the TANGENT slope at any point FROM the differential equation itself
The Basic Concept for all numerical methods for solving ODE’s is to use the TANGENT slope, available from the R.H.S. of the ODE, to approximate the chord slope
Recognize dy/dt as the Tangent Slope
),( nntt
n ytfdt
dym
n
),( slopetangent ytf nnt
nn ytfdt
dy
t
yy
n
,1
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 22
Bruce Mayer, PE Chabot College Mathematics
Euler Method – 1st Order ODE
Solve 1st Order ODE with I.C.
ReArranging
Use: [Chord Slope] [Tangent Slope at start of time step]
),( ytfdt
dy
by )0( nnn ftyy 1
Then Start the “Forward March” with Initial Conditions
byt 00 0 nnt
nn ytfdt
dy
t
yy
n
,1
or1 nt
n ydt
dyty
n
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 23
Bruce Mayer, PE Chabot College Mathematics
Example Euler Estimate
Consider 1st Order ODE with I.C.
Use The Euler Forward-Step Reln
See Next Slide for the 1st Nine Steps For Δt = 0.1
1 ydt
dy
0)0( y
)1(1 nnn ytyy
ntn
nnn
dt
dyty
ftyy
1
But from ODE
So In This Example:
1 nt
ydt
dy
n
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 24
Bruce Mayer, PE Chabot College Mathematics
Euler Exmple Calc
n tn yn fn= – yn+1 yn+1= yn+Dt fn
0 0 0.000 1.000 0.100
1 0.1 0.100 0.900 0.190
2 0.2 0.190 0.810 0.271
3 0.3 0.271 0.729 0.344
4 0.4 0.344 0.656 0.410
5 0.5 0.410 0.590 0.469
6 0.6 0.469 0.531 0.522
7 0.7 0.522 0.478 0.570
8 0.8 0.570 0.430 0.613
9 0.9 0.613 0.387 0.651
1.01 tydt
dy
Plot
Slope
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 25
Bruce Mayer, PE Chabot College Mathematics
Euler vs Analytical
0
0.2
0.4
0.6
0.8
0
0.2
5
0.5
0.7
5 1
1.2
5t
Exact
Numerical
y
tey 1
The Analytical Solution
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 26
Bruce Mayer, PE Chabot College Mathematics
Analytical Soln
Let u = −y+1 Then
001 tyydt
dy
dudy
dydu
yu
10
1
Sub for y & dy in ODE
udt
du
Separate Variables
dtu
du
Integrate Both Sides
dtu
du 1
Recognize LHS as Natural Log
Ctu ln
Raise “e” to the power of both sides
Ctu ee ln
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 27
Bruce Mayer, PE Chabot College Mathematics
Analytical Soln
And
001 tyydt
dy
Thus Soln u(t)tKeu
Sub u = 1−y
Now use IC
The Analytical Soln
ttCCt
u
Keeee
ue
ln
tKey 1
1
01 0
K
Ke
tey 11
tey 1
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 28
Bruce Mayer, PE Chabot College Mathematics
ODE Example: Euler Solution with
∆t = 0.25, y(t=0) = 37 The Solution Table
61.5ln2.4cos9.3 tydt
dy
0 1 2 3 4 5 6 7 8 9 1022
24
26
28
30
32
34
36
38
t
y(t)
by
Eul
er
Euler Solution to dy/dt = 3.9cos(4.2y)-ln(5.1t+6)
n t y dy/dt dely yn+1
0 0 37.0000 -1.7457 -0.4364 36.56361 0.25 36.5636 1.4027 0.3507 36.91432 0.5 36.9143 -1.3492 -0.3373 36.57693 0.75 36.5769 1.2410 0.3103 36.88724 1 36.8872 -1.2264 -0.3066 36.58065 1.25 36.5806 1.0448 0.2612 36.84186 1.5 36.8418 -0.7108 -0.1777 36.66417 1.75 36.6641 1.1868 0.2967 36.96088 2 36.9608 -2.5004 -0.6251 36.33579 2.25 36.3357 -2.6357 -0.6589 35.6768
10 2.5 35.6768 -1.6265 -0.4066 35.270111 2.75 35.2701 0.0722 0.0181 35.288212 3 35.2882 -0.2436 -0.0609 35.227313 3.25 35.2273 0.4430 0.1107 35.338014 3.5 35.3380 -1.1420 -0.2855 35.052615 3.75 35.0526 -0.0139 -0.0035 35.049116 4 35.0491 -0.1072 -0.0268 35.022317 4.25 35.0223 -0.5255 -0.1314 34.890918 4.5 34.8909 -2.6041 -0.6510 34.239919 4.75 34.2399 -1.1497 -0.2874 33.952420 5 33.9524 -3.0108 -0.7527 33.199721 5.25 33.1997 -3.0006 -0.7502 32.449622 5.5 32.4496 -3.0151 -0.7538 31.695823 5.75 31.6958 -2.9862 -0.7466 30.949224 6 30.9492 -3.0384 -0.7596 30.189725 6.25 30.1897 -2.9328 -0.7332 29.456426 6.5 29.4564 -3.1419 -0.7855 28.671027 6.75 28.6710 -2.6916 -0.6729 27.998128 7 27.9981 -3.5484 -0.8871 27.111029 7.25 27.1110 -1.7458 -0.4365 26.674530 7.5 26.6745 -2.8722 -0.7180 25.956531 7.75 25.9565 -2.4562 -0.6141 25.342432 8 25.3424 -0.4717 -0.1179 25.224533 8.25 25.2245 -2.2562 -0.5641 24.660434 8.5 24.6604 -0.0369 -0.0092 24.651235 8.75 24.6512 -0.0977 -0.0244 24.626836 9 24.6268 -0.2699 -0.0675 24.559337 9.25 24.5593 -1.0481 -0.2620 24.297338 9.5 24.2973 -3.9863 -0.9966 23.300739 9.75 23.3007 -0.9318 -0.2329 23.067840 10 23.0678 -1.0551 -0.2638 22.8040
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 29
Bruce Mayer, PE Chabot College Mathematics
Compare Euler vs. ODE45Euler Solution ODE45 Solution
0 1 2 3 4 5 6 7 8 9 1022
24
26
28
30
32
34
36
38
t
y(t)
by
Eul
er
Euler Solution to dy/dt = 3.9cos(4.2y)-ln(5.1t+6)
0 1 2 3 4 5 6 7 8 9 1034.5
35
35.5
36
36.5
37
37.5
T by ODE45
Y b
y O
DE
45
Euler is Much LESS accurate
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 30
Bruce Mayer, PE Chabot College Mathematics
Compare Again with ∆t = 0.025Euler Solution ODE45 Solution
0 1 2 3 4 5 6 7 8 9 1034.5
35
35.5
36
36.5
37
37.5
T by ODE45
Y b
y O
DE
45
Smaller ∆T greatly improves Result
0 1 2 3 4 5 6 7 8 9 1035.8
36
36.2
36.4
36.6
36.8
37
37.2
t
y(t)
by
Eul
er
Euler Solution to dy/dt = 3.9cos(4.2y)-ln(5.1t+6)
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 31
Bruce Mayer, PE Chabot College Mathematics
MatLAB Code for Euler% Bruce Mayer, PE% ENGR25 * 04Jan11% file = Euler_ODE_Numerical_Example_1201.m%y0= 37;delt = 0.25;t= [0:delt:10]; n = length(t);yp(1) = y0; % vector/array indices MUST start at 1tp(1) = 0;for k = 1:(n-1) % fence-post adjustment to start at 0 dydt = 3.9*cos(4.2*yp(k))^2-log(5.1*tp(k)+6); dydtp(k) = dydt % keep track of tangent slope tp(k+1) = tp(k) + delt; dely = delt*dydt delyp(k) = dely yp(k+1) = yp(k) + dely;endplot(tp,yp, 'LineWidth', 3), grid, xlabel('t'),ylabel('y(t) by Euler'),... title('Euler Solution to dy/dt = 3.9cos(4.2y)-ln(5.1t+6)')
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 32
Bruce Mayer, PE Chabot College Mathematics
MatLAB Command Window forODE45
>> dydtfcn = @(tf,yf) 3.9*(cos(4.2*yf))^2-log(5.1*tf+6);>> [T,Y] = ode45(dydtfcn,[0 10],[37]);>> plot(T,Y, 'LineWidth', 3), grid, xlabel('T by ODE45'), ylabel('Y by ODE45')
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 33
Bruce Mayer, PE Chabot College Mathematics
Example Euler Approximation
Use four steps of Δt = 0.1 with Euler’s Method to approximate the solution to
• With I.C.
SOLUTION: Make a table of values, keeping track
of the current values of t and y, the derivative at that point, and the projected next value.
10 ty
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 34
Bruce Mayer, PE Chabot College Mathematics
Example Euler Approximation
Use I.C. to calculate the Initial Slope
Use this slope to Project to the NEW value of yn+1 = yn + Δy:
Then the NEW value for y:
210
11
run
rise1,0, 2
00
mdt
dyyx
2.01.02 ytdt
dytytm
2.12.01001 yyy
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 35
Bruce Mayer, PE Chabot College Mathematics
Example Euler Approximation
Tabulating the remaining Calculations
The table then DEFINES y = f(t) Thus, for example, y(t=0.3) = 1.685
yhdtdy dtdy yy
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 36
Bruce Mayer, PE Chabot College Mathematics
WhiteBoard Work
Problems From §9.4• P32 Population Extinction
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 37
Bruce Mayer, PE Chabot College Mathematics
All Done for Today
CarlRunge
Carl David Tolmé Runge
Born: 1856 in Bremen, Germany
Died: 1927 in Göttingen, Germany
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 38
Bruce Mayer, PE Chabot College Mathematics
Bruce Mayer, PELicensed Electrical & Mechanical Engineer
Chabot Mathematics
Appendix
–
srsrsr 22
a2 b2
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 39
Bruce Mayer, PE Chabot College Mathematics
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 40
Bruce Mayer, PE Chabot College Mathematics
[email protected] • MTH16_Lec-14_sec_9-4_ODE_SlopeFields_Euler.pptx 41
Bruce Mayer, PE Chabot College Mathematics