Download presentation
Presentation is loading. Please wait.
Published byStephen Lamb Modified over 9 years ago
1
Scientific Computing Numerical Solution Of Ordinary Differential Equations - Euler’s Method
2
Bungee Jumper – Coupled ODEs
3
We want to model the vertical dynamics of a jumper connected to a stationary platform with a bungee cord. F=ma Forces: – mg (gravity, g = acceleration due to gravity) – c d v 2 (drag force, c d = drag coefficient, v = velocity) (need to always retard v, so if falling (v>0) need force neg, if rising (v<0) need force pos to reduce dv/dt) (use sign(v) for drag force) – k (x-L) (spring force, x = distance measured down from platform, L = rest length of cord) –γ v (damping force, γ is damping coefficient of cord)
4
Bungee Jumper – Coupled ODEs We get Dividing by m we get: k = = 0 if x L
5
Bungee Jumper – Coupled ODEs Need to solve two simultaneous ODEs for x and v k = = 0 if x L
6
Solving First Order ODE’s A general form for a first order ODE is Or alternatively We desire a solution x(t) which satisfies this ODE and one specified boundary condition. x(a) = c
7
Initial Value Problem An Initial Value Problem (IVP) is to solve a differential equation (of some order) subject to one or more initial conditions.
8
Analytic Solutions Suppose This can be clearly solved by integration:
9
Numerical Solution For many ODE’s integration is not possible, need to do a numerical approximation to the solution. To find a numerical solution we divide the interval [a,b] for the independent variable t into n subintervals or steps.
10
Numerical Solution Then the value of the true solution is approximated at these n values of t. We denote the approximation at these pts by so that
11
Numerical Solution Let x(t) be the actual solution for dx/dt at the step values. Then, assuming no roundoff error, the difference in the calculated and true value is the truncation error,
12
Numerical Solution Numerical algorithms for solving 1 st order odes for an initial condition are based on one of two approaches: 1.Direct or indirect use of the Taylor series expansion for the solution function 2.Use of open or closed integration formulas.
13
Numerical Solution The various solution algorithms are classified into: One-step: calculation of x i+1 given the differential equation and previous value: x i Multi-step: in addition to the previous information the algorithm requires values of t and x outside of the interval under consideration.
14
Numerical Solution The first method considered is based on the Taylor series expansion. It forms the basis for some of the other methods.
15
Taylor Series For this method we express the solution x(t) about some starting point t 0 using a Taylor expansion. The ODE is given by
16
Taylor Series Thus, by substitution from Where and … etc
17
Error Analysis for Taylor Approximation Suppose we use the nth order Taylor series approximation to generate the value of x 1 =x(t 1 ). How close are we to the actual value?
18
Error Analysis for Taylor Approximation In general, suppose we generate points for x by: to generate the value of x i+1 =x(t i+1 ). How close are we to the actual value?
19
Error Analysis for Taylor Approximation The exact value for x(t i+1 ) is given by
20
Error Analysis for Taylor Approximation Algorithms for which the last term in expansion is dropped are of order h n. The error is of order h n+1. The local truncation error is bounded as follows where
21
Taylor Series Solution Note: differentiation of f(t,x) can be complicated. Direct Taylor expansion is not used other than the simplest case,
22
Euler’s Method
23
The problem with the simple Euler method is the inherent inaccuracy in the formula.
24
Euler’s Method The geometric interpretation is shown the diagram. x(t 0 ) x1x1 x(t 1 ) t0t0 t1t1 x(t) h t x
25
Euler’s Method The solution across the interval [t 0,t 1 ] is assumed to follow the line tangent to x(t) at t 0. x(t 0 ) x1x1 x(t 1 ) t0t0 t1t1 x(t) h t x
26
Euler’s Method When the method is applied repeatedly across several intervals in sequence, the numerical solution traces out a polygon segment with sides of slope f i, i=0,1,2,…,(n-1).
27
Euler’s Method The simple Euler method is a linear approximation, and is a perfect solution only if the function is linear (or at least linear in the interval). This is inherently inaccurate. Because of this inaccuracy small step sizes are required when using the algorithm.
28
http://numericalmethods.eng.usf.edu Example A ball at 1200K is allowed to cool down in air at an ambient temperature of 300K. Assuming heat is lost only due to radiation, the differential equation for the temperature of the ball is given by Find the temperature at seconds using Euler’s method. Assume a step size of seconds.
29
Solution Step 1: is the approximate temperature at http://numericalmethods.eng.usf.edu
30
Solution Cont For Step 2: is the approximate temperature at http://numericalmethods.eng.usf.edu
31
Solution Cont The exact solution of the ordinary differential equation is given by the solution of a non-linear equation as The solution to this nonlinear equation at t=480 seconds is http://numericalmethods.eng.usf.edu
32
Comparison of Exact and Numerical Solutions Figure 3. Comparing exact and Euler’s method http://numericalmethods.eng.usf.edu
33
Step, h (480) EtEt |є t |% 480 240 120 60 30 −987.81 110.32 546.77 614.97 632.77 1635.4 537.26 100.80 32.607 14.806 252.54 82.964 15.566 5.0352 2.2864 Effect of step size Table 1. Temperature at 480 seconds as a function of step size, h (exact) http://numericalmethods.eng.usf.edu
34
Comparison with exact results Figure 4. Comparison of Euler’s method with exact solution for different step sizes http://numericalmethods.eng.usf.edu
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.