Presentation laddar. Vänta.

Presentation laddar. Vänta.

1.Numerical differentiation and quadrature Discrete differentiation and integration ------------------------------------------------------------ 2. Ordinary.

Liknande presentationer


En presentation över ämnet: "1.Numerical differentiation and quadrature Discrete differentiation and integration ------------------------------------------------------------ 2. Ordinary."— Presentationens avskrift:

1 1.Numerical differentiation and quadrature Discrete differentiation and integration Ordinary differential equations Euler’s method, Runge-Kutta methods Systems of differential equations Initial value and boundary value problem Shooting method Numeriska beräkningar i Naturvetenskap och Teknik

2 f in the points: x 0 ±h Taylor expansion around x 0 =0 gives Maclaurin: Derivative Numeriska beräkningar i Naturvetenskap och Teknik

3 Derivative with Taylor expansion Difference Derivative in point form Local error Numeriska beräkningar i Naturvetenskap och Teknik

4 “Forward difference” Compare to the definition of the derivative : Local error In the same way: Numeriska beräkningar i Naturvetenskap och Teknik

5 Ordinary differential equations An ordinary differential equation is defined as: First order Second order Numeriska beräkningar i Naturvetenskap och Teknik

6 Euler’s method, discrete solution of first order ordinary diff. equations Based on the “forward difference” given above: which gives: Numeriska beräkningar i Naturvetenskap och Teknik

7 Runge-Kutta methods Start by integrating between step n and n+1 Taylor approx of f around the central point n+1/2 Integrate: Numeriska beräkningar i Naturvetenskap och Teknik

8 i.e. Numeriska beräkningar i Naturvetenskap och Teknik

9 Now one needs an estimate of f n+1/2 in the expression: Use Euler! At half way between points: i.e. with: Runge-Kutta of order 2 is given by: Numeriska beräkningar i Naturvetenskap och Teknik

10 Runge-Kutta of order 2 y n+1 to order h 3 at the cost of calculating f(x,y) in two points. Geometrical picture: x y Numeriska beräkningar i Naturvetenskap och Teknik

11 Runge-Kutta error of order 4 > rk3 Numeriska beräkningar i Naturvetenskap och Teknik

12 Runge-Kutta error of order 5 > rk4 Numeriska beräkningar i Naturvetenskap och Teknik

13 Exemple; solve with Euler’s method and RK4 and study precision Note that the solution is: …possibly another function Numeriska beräkningar i Naturvetenskap och Teknik

14 Higher order ordinary differential equations Can be solved as a system of first order equations by substitution: So, an ordinary differential equation of order n can be solved numerically by e.g. RK4 as defined for a first order ordinary differential equation. Numeriska beräkningar i Naturvetenskap och Teknik

15 condition on y’ Conditions A differential equation of order n is completely determined only if n conditions are are given for the solution. Compare to the simple differential equation: Initial value problems condition on y Conditions given for the same value of the independent variable. An example for the case above is: y’(0)=2, y(0)=0. In classical mechanics this could e.g. correspond to knowing the position and velocity at a given time. Numeriska beräkningar i Naturvetenskap och Teknik

16 On the board… Numeriska beräkningar i Naturvetenskap och Teknik Second example on the board… Second order equation transferred to system.

17 Boundary value problems In this case one knows the value of the function (and/or its derivatives) for different values of the independent variable. An exemple from physics is the case of a second order differential equation : There are several ways of solving this problem numerically. A simple method is to transfer the problem to become an initial value problem: and find values for γ that gives solutions that ”shoot over” or ”under” the boundary value in point b. The value forγ which gives a value for y(b) within a given accuracy from βis then solved for. This method is called the “shooting method”. See page 329… Numeriska beräkningar i Naturvetenskap och Teknik

18 Boundary value problem Numeriska beräkningar i Naturvetenskap och Teknik

19 Boundary value problem dvs Numeriska beräkningar i Naturvetenskap och Teknik

20 Boundary value problem Numeriska beräkningar i Naturvetenskap och Teknik

21 Example, boundary value problem Numeriska beräkningar i Naturvetenskap och Teknik

22 Quadrature: Trapetzoidal rule Linear interpolation Numeriska beräkningar i Naturvetenskap och Teknik

23 Trapetzoidal rule Area between x-h and x+h hh f -1 f1f1 f0f0 Numeriska beräkningar i Naturvetenskap och Teknik

24 Trapetzoidal rule with error estimate: f -1 f0f0 f1f1 h h Numeriska beräkningar i Naturvetenskap och Teknik

25 f -1 f0f0 f1f1 h h Simpson’s rule: Approximate by Taylor expansion Integrated over x gives 0 Numeriska beräkningar i Naturvetenskap och Teknik


Ladda ner ppt "1.Numerical differentiation and quadrature Discrete differentiation and integration ------------------------------------------------------------ 2. Ordinary."

Liknande presentationer


Google-annonser