Top Banner
Ordinary Differential Equations Monday, October 10, 11
39

Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Jul 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Ordinary Differential Equations

Monday, October 10, 11

Page 2: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Problems involving ODEs can always be reduced to a set of first order differential equations. For example,

By introducing a new variable z, this can be rewritten as:

This exemplifies the procedure for an arbitrary ODE. The usual choice for the new variables is to let them just be derivatives of each other and of the original variable.

Monday, October 10, 11

Page 3: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Let common sense be your guide: If you find that the original variables are smooth in a solution, while your auxiliary variables are doing crazy things, then figure out why and choose different auxiliary variables.

Monday, October 10, 11

Page 4: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 5: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Lorenz Oscillator

Monday, October 10, 11

Page 6: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 7: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 8: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Non-linearities may exist

Monday, October 10, 11

Page 9: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

• Is a problem involving ODEs completely specified by its equations?

Monday, October 10, 11

Page 10: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

• Is a problem involving ODEs completely specified by its equations?

• NO! Even more crucial in determining how to attack the problem numerically is the nature of the boundary conditions. Boundary conditions are algebraic conditions on the values of the functions yi in:

Monday, October 10, 11

Page 11: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 12: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

• In general, the boundary conditions can be specified at discrete points, but do not hold between those points, i.e. are not preserved automatically by the differential equations.

• Boundary conditions may be as simple as requiring that certain variables have certain numerical values, or as complicated as a set of non-linear algebraic equations among the variables.

Monday, October 10, 11

Page 13: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

• Usually it is the nature of the boundary conditions that determines which numerical methods will be feasible. Boundary conditions divide into two broad categories.

Monday, October 10, 11

Page 14: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

The underlying idea of any routine for solving the initial value problem is always this: Rewrite the dy’s and dx’s in

as finite steps in ∆y and ∆x, and multiply the equations by ∆x. This gives algebraic formulas for the change in the functions when the independent variable, x, is “stepped” by one “stepsize” ∆x. In the limit of making the stepsize very small (∆x→0), a good approximation to the underlying differential equation is achieved.

Monday, October 10, 11

Page 15: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

The underlying idea of any routine for solving the initial value problem is always this: Rewrite the dy’s and dx’s in

as finite steps in ∆y and ∆x, and multiply the equations by ∆x. This gives algebraic formulas for the change in the functions when the independent variable, x, is “stepped” by one “stepsize” ∆x. In the limit of making the stepsize very small (∆x→0), a good approximation to the underlying differential equation is achieved.

Monday, October 10, 11

Page 16: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Literal implementation of this procedure results in Euler’s method, which is however not recommended for any practical use. Euler’s method is conceptually important, however; one way or another practical methods all come down to the same idea:

Add small increments to your functions corresponding to derivatives (right-hand sides

of the equations) multiplied by stepsizes.

Monday, October 10, 11

Page 17: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 18: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 19: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 20: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Homework 4

• Starting from the conditions below write a Euler integration for the simple harmonic oscillator to produce the plot on the right.

• Why are the solutions diverging?

0 2 4 6 8 10 12 14 16 18 20ï3

ï2

ï1

0

1

2

3

4

Time

Loca

tion

Harmonic Oscillator

Monday, October 10, 11

Page 21: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

• Solve the same ODEs by calling ODE23, ODE45, ODE113 overlay on the Euler solutions like on the plot to the right. 0 2 4 6 8 10 12 14 16 18 20

ï3

ï2

ï1

0

1

2

3

4

Time

Loca

tion

Harmonic Oscillator

Homework 4

Monday, October 10, 11

Page 22: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 23: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

0 2 4 6 8 10 12 14 16 18 20ï3

ï2

ï1

0

1

2

3

4

Time

Loca

tion

Harmonic Oscillator

As the step size increased so did the error! Why?

Monday, October 10, 11

Page 24: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

0 2 4 6 8 10 12 14 16 18 20ï3

ï2

ï1

0

1

2

3

4

Time

Loca

tion

Harmonic Oscillator

As the step size increased so did the error! Why?

The slope changes over our time step, but in Euler’s method we assume it is constant.

Monday, October 10, 11

Page 25: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 26: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 27: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 28: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

ODE Solvers

• There are three types of solvers:

• Runge-Kutta Methods

• Richardson extrapolation and in particular the Burlish-Stoer method

• Predictor corrector methods

Monday, October 10, 11

Page 29: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

ODE Solvers

Monday, October 10, 11

Page 30: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Which method should I use?

Monday, October 10, 11

Page 31: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Which method should I use?

Monday, October 10, 11

Page 32: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 33: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 34: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 35: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 36: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 37: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 38: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Monday, October 10, 11

Page 39: Ordinary Differential Equations · differential equation is achieved. Monday, October 10, 11. The underlying idea of any routine for solving the initial value problem is always this:

Exercise

• Look at Matlab help: doc ode23

• Do the three examples

• Open the document odes.pdf and read about the Lorenz attractor in section 7.8

• Look at the Lorenz attractor example lorenzgui.m

• Read about stiff systems in section 7.9

• Read chapter 17 of Numerical Recipes

Monday, October 10, 11