1 / 41

Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu

Chabot Mathematics. §9.4 ODE Analytics. Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. 9.3. Review §. Any QUESTIONS About §9.3 Differential Equation Applications Any QUESTIONS About HomeWork §9.3 → HW-15. §9.4 Learning Goals.

john
Download Presentation

Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chabot Mathematics §9.4 ODEAnalytics Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu

  2. 9.3 Review § • Any QUESTIONS About • §9.3 Differential Equation Applications • Any QUESTIONS About HomeWork • §9.3 → HW-15

  3. §9.4 Learning Goals • Analyze solutions ofdifferential equationsusing slope fields • Use Euler’s methodfor approximating solutions of initialvalue problems

  4. 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

  5. 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

  6. 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

  7. 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:

  8. 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

  9. Slope Fields • Of course this Variable Separable ODE can be easily solved analytically

  10. Slope Fields  Example • For the given slope field, sketch two approximate solutions – one of which is passes through(4,2): • Solve ODE Analytically usingusing (4,2) BC Soln

  11. Slope Field Identification Match the correct DE with its graph: • In order to determine a slope field from a differential equation, we should consider the following: • If isoclines (points with the same slope) are along horizontal lines, then DE depends only on y • Do you know a slope at a particular point? • If we have the same slope along vertical lines, then DE depends only on x • Is the slope field sinusoidal? • What x and y values make the slope 0, 1, or undefined? • dy/dx = a(x ±y) has similar slopes along a diagonal. • Can you solve the separable DE? A B H 1. _____ F 2. _____ C D D 3. _____ C 4. _____ E F A 5. _____ G 6. _____ G H E 7. _____ B 8. _____

  12. 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

  13. Example  Demand Slope Field • SOLUTION: • Calculate some Slope Values from

  14. 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

  15. 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

  16. Example  Demand Slope Field • Removing ABS Bars • Or • Now use Boundary Value ($2k/unit,0.5)

  17. Example  Demand Slope Field • Graph for • This is VERY SIMILAR to the Slope Field Graph Sketched Before

  18. 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

  19. Notation Numerical Solution - 1 • Exact Numerical Method (impossible to achieve) by Forward Steps yn+1 yn • Now Consider t tn tn+1 Dt

  20. Numerical Solution - 2 • The diagram at Left shows that the relationship between yn, yn+1 and the CHORD slope yn+1 Tangent Slope yn Chord Slope • 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 t tn tn+1 Dt The AnalystChooses Δt

  21. However, we can calculate the TANGENT slope at any point FROM the differential equation itself Numerical Solution -3 • 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

  22. Solve 1st Order ODE with I.C. Euler Method – 1st Order ODE • ReArranging • Use: [Chord Slope]  [Tangent Slope at start of time step] • Then Start the “Forward March” with Initial Conditions

  23. Consider 1st Order ODE with I.C. Example  Euler Estimate • But from ODE • So In This Example: • Use The Euler Forward-Step Reln • See Next Slide for the 1st Nine Steps For Δt = 0.1

  24. Euler ExmpleCalc Slope Plot

  25. Euler vs Analytical • The Analytical Solution

  26. Let u = −y+1 Then Analytical Soln • Integrate Both Sides • Recognize LHS as Natural Log • Sub for y & dy in ODE • Raise “e” to the power of both sides • Separate Variables

  27. And Analytical Soln • Now use IC • The Analytical Soln • Thus Soln u(t) • Sub u = 1−y

  28. ODE Example: • Euler Solution with ∆t = 0.25, y(t=0) = 37 • The Solution Table

  29. Compare Euler vs. ODE45 Euler Solution Euler is Much LESS accurate ODE45 Solution

  30. Compare Again with ∆t = 0.025 Euler Solution Smaller ∆T greatly improves Result ODE45 Solution

  31. 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 1 tp(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; end plot(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)')

  32. 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')

  33. 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.

  34. 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:

  35. Example  Euler Approximation • Tabulating the remaining Calculations • The table then DEFINES y = f(t) • Thus, for example, y(t=0.3) = 1.685

  36. WhiteBoard Work • Problems From §9.4 • P32 Population Extinction

  37. All Done for Today CarlRunge Carl David Tolmé Runge Born: 1856 in Bremen, Germany Died: 1927 in Göttingen, Germany

  38. Chabot Mathematics Appendix Do On Wht/BlkBorad Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu –

More Related