Solutions to ODEs - PowerPoint PPT Presentation

1 / 92
About This Presentation
Title:

Solutions to ODEs

Description:

Solutions to ODEs A general form for a first order ODE is Or alternatively A general form for a first order ODE is Or alternatively We desire a solution y(x) which ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 93
Provided by: cavehillU
Category:
Tags: odes | solutions

less

Transcript and Presenter's Notes

Title: Solutions to ODEs


1
Solutions to ODEs
2
  • A general form for a first order ODE is
  • Or alternatively

3
  • A general form for a first order ODE is
  • Or alternatively
  • We desire a solution y(x) which satisfies (1) and
    one specified boundary condition.

4
  • To do this we divide the interval in the
    independent variable x for the interval a,b
    into subintervals or steps.

5
  • To do this we divide the interval in the
    independent variable x for the interval a,b
    into subintervals or steps.
  • Then the value of the true solution is
    approximated at n1 evenly spaced values of x.
  • Such that,
  • where,

6
  • We denote the approximation at the base pts by
    so that

7
  • We denote the approximation at the base pts by
    so that
  • The true derivation dy/dx at the base points is
    approximated by or just
  • where

8
  • We denote the approximation at the base pts by
    so that
  • The true derivation dy/dx at the base points is
    approximated by or just
  • where
  • Assuming no roundoff error the difference in the
    calculated and true value is the truncation error,

9
  • The only errors which will be examined are those
    inherent to the numerical methods.

10
  • Numerical algorithms for solving 1st order odes
    for an initial condition are based on one of two
    approaches
  • Direct or indirect use of the Taylor series
    expansion for the solution function
  • Use of open or closed integration formulas.

11
  • The various procedures are classified into
  • One-step calculation of given the
    differential equation and
  • Multi-step in addition the previous information
    they require values of x and y outside of the
    interval under consideration

12
  • The first method considered is the Taylor series
    method.
  • It forms the basis for some of the other methods.

13
Taylor Expansion
14
  • For this method we express the solution about
    some starting point using a Taylor expansion.

15
  • where

16
  • Where
  • And
  • etc.

17
  • Consider the example, where
  • And initial condition

18
  • Consider the example, where
  • And initial condition
  • Differentiating and then applying initial
    conditions,

19
  • Consider the example, where
  • And initial condition
  • Differentiating and then applying initial
    conditions,

20
  • Consider the example, where
  • And initial condition
  • Differentiating and then applying initial
    conditions,

21
  • Consider the example, where
  • And initial condition
  • Differentiating and then applying initial
    conditions,

22
  • Continuing,

23
  • Continuing,

24
  • Continuing,
  • . .
  • . .
  • Here the third derivative and higher are zero.

25
  • Substituting these values into Taylor expansion
    gives,

26
  • Substituting these values into Taylor expansion
    gives,
  • To determine the error lets consider compare this
    to the analytic solution.

27
  • Substituting these values into Taylor expansion
    gives,
  • To determine the error lets consider compare this
    to the analytic solution.
  • To do this we will integrate the differential
    equation.

28
  • Integrating,

29
  • Integrating,

30
  • Integrating,

31
  • Integrating,
  • Simplifying,

32
  • In this case the two expressions are identical,
    therefore there is no truncation error.

33
Homework (Due Thursday)
  • Consider the function
  • Initial condition
  • Write the Taylor expansion and show that it can
    be written in the form,
  • Show if terms up to are retained, the
    error is,

34
  • Stepping from to follows from the
    Taylor expansion of about .

35
  • Stepping from to follows from the
    Taylor expansion of about .
  • Equivalently stepping from to can be
    accomplished from the Taylor expansion of
    about .

36
  • Stepping from to follows from the
    Taylor expansion of about .
  • Equivalently stepping from to can be
    accomplished from the Taylor expansion of
    about .

37
  • Algorithms for which the last term in expansion
    is dropped are of order hn.
  • The error is or order hn1.
  • The local truncation error is bounded as follows
  • where

38
  • However differentiation of can be
    complicated.

39
  • However differentiation of can be
    complicated.
  • Direct Taylor expansion is not used other than
    the simplest case,
  • Big Oh is the order of the algorithm.

40
  • Usually only the value of is the only
    value of that is known, therefore must
    be replaced by .
  • Thus,
  • In general,
  • which is known as Eulers method.

41
Eulers Method
42
  • The problem with the simple Euler method is the
    inherent inaccuracy in the formula.

43
  • The geometric interpretation is shown the diagram.

44
  • The solution across the intervalx0,x1 is
    assumed to follow the line tangent to y(x) at x0.

45
  • When the method is applied repeatedly across
    several intervals in sequence, the numerical
    solution traces out a polygon segment with sides
    of slope fi, i0,1,2,,(n-1).

46
  • The simple Euler method is a linear
    approximation, and only works if the function is
    linear (or at least linear in the interval).

47
  • The simple Euler method is a linear
    approximation, and only works 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.

48
  • From the graph, as h -gt 0, the approximation
    becomes better because the curve in the region
    becomes approx. linear.

49
  • The modified Euler method improves on the simple
    Euler method.

50
Modified Euler
51
  • One modification is to determine the average
    slope in the region.
  • The average slope may be approximated by the mean
    of the slopes at the beginning and the end of the
    interval.

52
  • One modification is to determine the average
    slope in the region.
  • The average slope may be approximated by the mean
    of the slopes at the beginning and the end of the
    interval.
  • This modified Euler may be written as the
    arithmetic average,
  • or

53
  • However it is not possible to implement this
    directly.
  • Instead we first predict a value for
    using the simple Euler method.
  • Then use this value to determine the gradient of
    the slope at . This gives a corrected
    value for .
  • However since the predicted value is not usually
    accurate, is also inaccurate.

54
Corrector curve using values of predictor
Predictor curve using the Simple Euler
True value
55
Runge-Kutta Methods
56
  • The solution of a differential equation using
    higher order derivatives of the Taylor expansion
    is not practical.

57
  • The solution of a differential equation using
    higher order derivatives of the Taylor expansion
    is not practical.
  • Since for only the simplest functions, these
    higher orders are complicated. Also there is no
    simple algorithm which can be developed.
  • This is because each series expansion is unique.

58
  • However we have methods which use only 1st order
    derivates while simulating higher order(producing
    equivalent results).
  • These one step methods are called Runge-Kutta
    methods.

59
  • However we have methods which use only 1st order
    derivates while simulating higher order(producing
    equivalent results).
  • These one step methods are called Runge-Kutta
    methods.
  • Approximation of the second, third and fourth
    order (retaining h2, h3, h4 respectively in the
    Taylor expansion) require estimation at 2, 3 , 4
    pts respectively in the interval (xi,xi1).

60
  • Method of order m (where m gt4) require derivate
    evaluation at more than m nearby points.

61
  • The Runge-Kutta methods have algorithms of the
    form,
  • where is the increment function.
  • The increment function is a suitably chosen
    approximation to on the interval
    .

62
  • The Runge-Kutta methods have algorithms of the
    form,
  • where is the increment function.
  • The increment function is a suitably chosen
    approximation to on the interval
    .
  • Because of the amount of algebra involved, on the
    simplest case(2nd order) will be derived in
    detail.

63
Derivation of the 2nd order Runge-Kutta
64
  • Let be the weighted average of two derivative
    evaluations and on the interval
    ,

65
  • Let be the weighted average of two derivative
    evaluations and on the interval
    ,

66
  • Let be the weighted average of two derivative
    evaluations and on the interval
    ,
  • Then,

67
  • Let be the weighted average of two derivative
    evaluations and on the interval
    ,
  • Then,
  • Let,
  • The constants p and q will be established.

68
  • Expanding in a Taylor series for a function of
    two variables and dropping terms higher than h,
  • NB 1st few terms in two-variable Taylor series,

69
  • Recall
  • Substituting for ,

70
  • Recall
  • Substituting for ,
  • Expanding the function about

71
  • Using the chain rule can be written
    as,

72
  • Using the chain rule can be written
    as,
  • Equating like terms in equation 1 and 2,

73
  • Assuming that we compare coefficients.
    So that,

74
  • Assuming that we compare coefficients.
    So that,
  • Therefore,

75
  • Assuming that we compare coefficients.
    So that,
  • Therefore,
  • However we have four unknowns and only three
    equations.
  • We have the variable b which can be chosen
    arbitrarily.
  • Two common choices are and

76
  • For . and we
    get,
  • which can be written as,
  • where
  • This improved Euler method or Heuns Method.

77
  • Geometric Interpretation

78
(No Transcript)
79
  • For . and we
    get,
  • where
  • This improved polygon method or the modified
    Eulers Method.

80
(No Transcript)
81
  • Geometric Interpretation

82
  • Higher Orders

83
  • The higher orders are developed in the way as the
    2nd order Runge-Kutta.
  • Consider the 3rd order Runge-Kutta,
  • approximate the derivative at
    the points on the interval.

84
  • The higher orders are developed in the way as the
    2nd order Runge-Kutta.
  • Consider the 3rd order Runge-Kutta,
  • approximate the derivative at
    the points on the interval.
  • For this case,

85
  • Third order Runge-Kutta algorithms are of the
    form,

86
  • Third order Runge-Kutta algorithms are of the
    form,
  • To determine a,b,c,p,r and s,
  • First expand about

87
  • Third order Runge-Kutta algorithms are of the
    form,
  • To determine a,b,c,p,r and s,
  • First expand about
  • Expand as a Taylor series.

88
  • Third order Runge-Kutta algorithms are of the
    form,
  • To determine a,b,c,p,r and s,
  • First expand about
  • Expand as a Taylor series.
  • Compare coefficients of the Runge-Kutta and
    Taylor series.

89
  • The equations formed are,
  • Two of the constants a,b,c,p,r,s are arbitrary.

90
  • For one set of constant, selected by Kutta the
    third order algorithm is,

91
  • For one set of constant, selected by Kutta the
    third order algorithm is,
  • If is a function of x only then this
    reduces to the Simpsons rule.

92
  • Runge-Kutta formulas of higher orders can be
    developed using a similar procedure.
Write a Comment
User Comments (0)
About PowerShow.com