Differential equations There are ordinary differential equations functions

  • Slides: 19
Download presentation
Differential equations There are ordinary differential equations functions of one variable And there are

Differential equations There are ordinary differential equations functions of one variable And there are partial differential equations functions of multiple variables

Order of differential equations 1 st order 2 nd order etc.

Order of differential equations 1 st order 2 nd order etc.

Can always turn a higher order ode into a set of 1 st order

Can always turn a higher order ode into a set of 1 st order ode’s Example: Let then So solutions to 1 st order are important

Linear and nonlinear ODEs Linear: No multiplicative mixing of variables, no nonlinear functions Nonlinear:

Linear and nonlinear ODEs Linear: No multiplicative mixing of variables, no nonlinear functions Nonlinear: anything else

Sometimes can linearize Example: for small angles then which is linear

Sometimes can linearize Example: for small angles then which is linear

ODEs show up everywhere in engineering • dynamics (Newton’s 2 nd law) • heat

ODEs show up everywhere in engineering • dynamics (Newton’s 2 nd law) • heat conduction (Fourier’s law) • diffusion (Fick’s law)

We’re going to cover • Euler and Heun's methods • Runge-Kutta methods • Adaptive

We’re going to cover • Euler and Heun's methods • Runge-Kutta methods • Adaptive Runge-Kutta • Multistep methods • Adams-Bashforth-Moulton methods • Boundary value problems Goal is to get y(x) from dy/dx=f(x)

Runge Kutta methods - one step methods Idea is that New value=old value+slope*step size

Runge Kutta methods - one step methods Idea is that New value=old value+slope*step size or Slope is generally a function of x, hence y(x) Different methods differ in how to estimate

Euler’s method Use differential equation to estimate slope, by plugging in current values of

Euler’s method Use differential equation to estimate slope, by plugging in current values of x and y Example: let Integrate from 1 to 7. Let h=0. 5. Initial condition is y(1)=1. Use f for

Begin at x=1

Begin at x=1

Ok, not so great Truncation errors Round off errors There is • local truncation

Ok, not so great Truncation errors Round off errors There is • local truncation error - error from application at a single step • propagated truncation error - previous errors carried forward sum is Global truncation error

Euler’s method uses Taylor series with only first order terms Error is Neglect higher

Euler’s method uses Taylor series with only first order terms Error is Neglect higher order terms

Example - Local error at any x See Excel sheet

Example - Local error at any x See Excel sheet

Error can be reduced by smaller h - see Excel sheet

Error can be reduced by smaller h - see Excel sheet

Effect of reducing step size Error vs h

Effect of reducing step size Error vs h

Improvements of Euler’s method - Heun’s method • derivative at beginning of interval is

Improvements of Euler’s method - Heun’s method • derivative at beginning of interval is applied to entire interval • Heun’s method uses average derivative for entire interval

Graph of function with slope arrows explaining Heun’s method Average the slopes

Graph of function with slope arrows explaining Heun’s method Average the slopes

Heun’s method is a predictor-corrector method • predictor • corrector

Heun’s method is a predictor-corrector method • predictor • corrector

Example of Heun’s method - see Excel first few iterations y. Heun(0)=2 (given) y

Example of Heun’s method - see Excel first few iterations y. Heun(0)=2 (given) y 0=y. Heun(0)+f(0)*h=2 -500*0. 5=-248 y. Heun(0. 5)=y. Heun(0)+(f(0)+f(0. 5))/2*0. 5 =2+(-500 -245. 5)/2*0. 5=-184. 375 y 0=y. Heun(0. 5)+f(0. 5)*h y. Heun(1)=y. Heun(0. 5)+(f(0. 5)+f(1))/2*h