MS3200 Anum Part 2

47
Rac 2015 1 MS MS3200 200 Numerical Analysis Numerical Analysis MS MS3200 200 Numerical Analysis Numerical Analysis Part 2 Part 2 Dr. Ir. Rachman Setiawan Engineering Design Centre ( h l b) (Mechanical Design Lab.) Tel. 2500979 E-mail: [email protected] 8. Curve Fitting 8. Curve Fitting 8.1 Introduction Purpose: To represent a function based on knowledge its behaviour at certain discrete points. There are two approaches: Interpolation produces a function that matches the given data exactly Regression produces an approximate function for the given data Application: Trend Analysis 57 Trend Analysis Hypothesis testing Source of Data: Experimental data Discrete numerical solution

description

MS3200 Analisis Numerik Slide

Transcript of MS3200 Anum Part 2

  • Rac 2015 1

    MSMS33200200 Numerical AnalysisNumerical AnalysisMSMS33200200 Numerical AnalysisNumerical AnalysisPart 2Part 2

    Dr. Ir. Rachman SetiawanEngineering Design Centre( h l b )(Mechanical Design Lab.)

    Tel. 2500979E-mail: [email protected]

    8. Curve Fitting8. Curve Fitting8.1 Introduction

    Purpose: To represent a function based on knowledge its behaviour at certain discrete points.pThere are two approaches:

    Interpolation produces a function that matches the given data exactly

    Regression produces an approximate function for the given data

    Application: Trend Analysis

    57

    Trend AnalysisHypothesis testing

    Source of Data:Experimental dataDiscrete numerical solution

  • Rac 2015 2

    58

    Interpolation (polynomial) Regression (linear)

    Comparison between Interpolation & Regression

    Interpolation Regression The data is very precise Curve fits each points exactly Example: relationship generates

    from exact solution/calculation

    The data contains error or noise Curve does not necessarily fit

    each points exactly but represents the general trend of the data

    59

    Example: experimental result

  • Rac 2015 3

    8.2 Interpolation8.2.1 Newtons Divided-Difference

    Making use of a Polynomial form to fit a curve Polynomial g y yinterpolation:

    It requires (n + 1) datapoints for n-th order polynomial

    60

    While Polynomial is the form of fitting, one of the methods is Newtons Divided-difference.

    The simplest method of Newtons DD is by using Linear form Linear Interpolation

    001

    0101

    01

    01

    0

    01

    xxxx

    xfxfxfxf

    xxxfxf

    xxxfxf

    Finite divided differenceapproximation of the first derivative

    61

    Datapoints: [x0, f(x0)], [x1, f(x1)]

  • Rac 2015 4

    General form of Newtons Interpolating Polynomials

    110010

    xfbxxxxxxbxxbbxf nnn

    011

    0122

    011

    00

    ,,,,

    ,,,

    xfxfwhere

    xxxxfb

    xxxfbxxfb

    xfb

    ji

    nnn

    62

    0

    01111011

    ,,,,,,,,,,

    ,

    xxxxxfxxxfxxxxf

    xxxfxf

    xxf

    n

    nnnnn

    ji

    jiji

    Recursive nature of Newtons divided differences:

    010120010 ,,,

    nxxxxxxxxxxf

    xxxxxxxfxxxxfxfxf

    63

    110011 ,,,, nnn xxxxxxxxxxf

  • Rac 2015 5

    Algorithm

    f( )f(xi) = yi

    ji

    jiji xx

    xfxfxxf

    ,

    S d t

    First stage

    64

    -Second stage-yint2 f2(x)-Error

    Effects on higher order (Ex 18.3): Ln 2 = 0.6931472 (true value)

    order Data points required

    f(x) t (%)

    1st (linear) 2 0.4621 33.3

    2nd (quadratic) 3 0.5658 18.4

    3rd (cubic) 4 0.6288 9.3

    65

  • Rac 2015 6

    8.2.3 Lagrange Form

    nj

    i

    n

    iin xxxx

    xLxfxLxf ;

    Rationale: Each term of Li(xi) is 1 at x = xi and zero at all other

    datapoints takes the value of f(xi) at data point xi. Therefore, the curve passes through each data points A

    h t i ti f I t l ti

    ijj jii xx00

    66

    characteristic of Interpolation

    Example: Lagrange Interpolating polynomial orde-3

    3

    xfLxfLxfLxfLxfxLxf

    323

    2

    13

    1

    03

    02

    32

    3

    12

    1

    02

    0

    131

    3

    21

    2

    01

    00

    30

    3

    20

    2

    10

    13

    332211000

    3

    xfxxxx

    xxxx

    xxxxxf

    xxxx

    xxxx

    xxxx

    xfxxxx

    xxxx

    xxxxxf

    xxxx

    xxxx

    xxxxxf

    xfLxfLxfLxfLxfxLxfi

    ii

    67

  • Rac 2015 7

    8.2.4 Interpolating Polynomial Form

    nnn xaxaxaaxf ...2210

    Steps: Build system of linear equations in form of matrix problem Solve using ordinary Gauss/Gauss-Jordan/etc..

    nnf 210

    nn xfxaxaxaa ... 00202010

    n xfaxxx 00

    20

    2001

    68

    nnnnnn

    nn

    xfxaxaxaa

    xfxaxaxaa

    ...

    ...

    2210

    112

    12110

    nnn

    nnn

    n

    xf

    xfxf

    a

    aa

    xxx

    xxx

    2

    1

    2

    1

    2

    12

    11

    1111

    8.2.5 Inverse Interpolation

    Evenly-spacedx = ??

    1429.01667.02000.02500.03333.05000.00000.17654321

    xfx

    x = ??

    69

    Mostly unevenly-spacedSample Problem!!: Find x, to give f(x) = 0.3

  • Rac 2015 8

    8.2.5 Inverse Interpolation Obvious method:

    Switching x f(x) f(x) x ?? oscillation in resultSwitching x f(x), f(x) x ?? oscillation in result Alternative method:

    Interpolating polynomial, then root of polynomial Steps:

    Choose order of polynomials Set up linear algebraic system Find coefficients: a0, a1, ... , an

    70

    Solve for known f(x), to find x using root finding algorithm:

    baaxaxaxaaxaxaxaabn

    n

    nn

    002

    210

    2210

    ' :where0...'

    ...

    Root finding problem

    8.2.6. Spline Interpolation

    Segmen IISegmen III Principles:

    Segmen ISegmen II

    ... 1. At first and end points, the value of functions = datapoints

    2 At interior nots the value

    11

    2

    nnm yxf

    yxf

    001

    71

    2. At interior nots, the value of adjacent functions must be equal

    2

    11 ijij xfxf ij xf jth Segmentith data

  • Rac 2015 9

    8.2.6. Spline Interpolation

    Principles:Segmen IISegmen III

    3. At interior nots, slope of adjacent functions must be equal

    4. Assume, the first point has d d i ti

    11 ijij xfdxdxf

    dxd

    Segmen ISegmen II

    ...

    4

    3

    72

    zero second derivative:3

    ij xf jth Segmentith data

    0022

    xfdxd I

    8.2.6. Spline InterpolationExample: Quadratic Splines (Text Book EX. 18.9):

    Quadratic:

    Datapoints: (3.0,2.5); (4.5,1.0); (7.0,2.5);(9.0,0.5)

    Principles:

    jijijij cxbxaxf 2

    5.239 111 cba 0.14525.20 111 cba1 2

    73

    5.0981 111 cba

    5.27495.2749

    0.14525.20

    333

    222

    222

    cbacba

    cba1 2

    301414

    099

    3322

    2211

    baba

    baba4 01 a

  • Rac 2015 10

    8.2.6. Spline InterpolationExample: Quadratic Splines (Text Book EX. 18.9):

    In Matrix form:

    2

    1

    1

    1

    ...

    ...

    c

    acba

    Solve for: a1, b1, c1, a2, ..., c3

    74

    3c

    0.90.73.916.246.1

    0.75.446.1876.664.05.40.35.5

    2

    2

    xxxxfxxxxfxxxf

    III

    II

    I

    Other Advanced Topics: 8.2.5 Matrix Elimination coefficients* 8.2.6 Piece-wise Spline*p

    Self evaluation Newtons DD:

    ...,,

    ,,,,,,,,,,

    012

    0

    01111011

    xxxfxx

    xxxfxxxfxxxxfn

    nnnnn

    75

    Lagrange:

    ...

    ;

    2

    00

    xf

    xxxx

    xLxfxLxfn

    ijj ji

    ji

    n

    iiin

  • Rac 2015 11

    8.3 Regression8.3.1 Review on Statistics

    Consider a population of xi containing n members.p p i g Mean/average:

    Standard deviation:

    n

    iiyn

    y1

    1

    1

    2

    yys

    n

    ii s

    OVC y

    In a normalised form Coefficient of variance

    76

    1

    atau1

    222

    1

    nn

    yys

    ns

    iiy

    iy y

    OVC

    77

    Normal distribution

  • Rac 2015 12

    If the population is composed of a number of measurements, or numerical calculation: Mean Accuracy (the closeness to the true value) Standard deviation Precision (the closeness among

    other members) Regression makes use of this principle since, often, the

    population is scattered due to random error (from calculation or measurement)

    Like in interpolation, the representing curve can be of the form of linear, quadratic of general polynomial.

    78

    The big issue here is to choose the criteria for the best fit

    8.3.2 The Best-fit Criterion Supposed n data yi, to be fitted linearly (a0 + a1xi), so that containing

    error/residual, e that is defined by:

    The proposed criteria for Best fit : Minimise the sum of errors

    Minimise the sum of the absolute values of error

    Minimise the maximum of the error (Minimax)

    iii xaaye 10

    iemin

    iemin

    79

    Minimise the maximum of the error (Minimax)

    Minimise the sum of the squares of errors

    2min ie

    iemaxmin

  • Rac 2015 13

    Alternatives of The Best-fit Criterion:

    iemin

    iemin

    80

    iemaxmin

    The best proposed criterion is chosen to be the Least Squares Widely used in even more sophisticated regressions and will be used for the entire discussion

    2mod,, elfitimeasuredir yyS

    ii xaay 10

    81

    iiy 10

  • Rac 2015 14

    8.3.3 Quantification of Error of the Fitting The error Sum of squares (SSE) Sr

    2

    Other form: normalisation of SSE R-square (r2):

    This represents the relative discrepancy between squares

    t

    rt

    SSSr 2

    2iir xfyS

    2yyS it

    82

    p p y qof errors and the spread of the original data, yi .

    By taking square root Correlation coefficient (r). For a perfect fit r = 1, for total non-correlated r = 0.

    8.3.4 Least-Squares Linear Regression Minimisation first derivatives = 0 For a0 : For a1 :0 1

    Solving for the two equations:

    ii

    ii

    iir

    iir

    xanay

    xaay

    xaayaS

    xaayS

    10

    10

    100

    210

    0

    02

    iiii

    iiii

    iiir

    iir

    xyxaxa

    xaxaxy

    xxaayaS

    xaayS

    210

    210

    101

    210

    0

    02

    83

    g q

    Example 17.1

    xaya

    xxnyxyxn

    aii

    iiii

    10

    221

  • Rac 2015 15

    Use common sense to fit data, not necessarily linear. It could be parabolic, exponential, logarithmic, etc

    Linearization if necessary !

    84

    Linearization: Know the basic relationship ! Modify the equation into linear relationshipy q p

    xaay

    xbayeay xb

    10

    11

    'lnln1

    85

  • Rac 2015 16

    * Favourite Text Book Problems:17.6, compare the results with that of Ms Excel17 13 compare the results with that of Ms Excel17.13, compare the results with that of Ms Excel

    86

    8.3.5 Polynomial Regression (Least Squares) The minimisation of Sum of squares of errors (Least

    Squares): 22q )

    That is by differentiate Sr wrt each a0, a1, am:

    Solving for the system of equations a0, a1, am

    22210 mimiiir xaxaxaayS

    0,,0;010

    m

    rrr

    aS

    aS

    aS

    m yaxxxn 2

    87

    imi

    ii

    ii

    i

    mm

    imi

    mi

    mi

    miiii

    miiii

    iii

    yx

    yxyx

    y

    a

    aaa

    xxxx

    xxxxxxxxxxxn

    22

    1

    0

    221

    2432

    132

  • Rac 2015 17

    8.3.6 n-Dimensional Space Regression So far, we have 1 variable to regulate 1 function:

    Example: x f (x)Example: x f (x) Consider a problem with more than 1 variables to regulate

    1 response function Application: A phenomenon that is regulated by more than

    one input variables. The simplest form is Linear relationship having 2 input

    variables (Multiple Linear Regression):

    88

    So, the line in the two-dimensional space becomes flat-plane in the three-dimensional space.

    22110 xaxaay

    89

    Two-dimensional linear regression

  • Rac 2015 18

    The problem solving remains the same Express the sum of the squares of errors, Sr Differentiate Sr wrt each coefficients, a0, a1, and a2.r , 0, 1, 2 Build a system of equations in matrix form Solve it

    ii

    ii

    i

    iiii

    iiii

    ii

    yxyx

    y

    aaa

    xxxxxxxx

    xxn

    2

    1

    2

    1

    0

    22212

    21211

    21

    90

    8.3.7 Advanced Topics Non-linear regression Fourier Approximation Fourier Approximation Response Surface modelling Metamodelling/Neural Network

    91

  • Rac 2015 19

    9. Numerical Integration9. Numerical Integration9.1 Introduction

    Integration is summation with infinitesimally small division Numerical integration is approximation of the integration g pp g

    with finite difference

    nnn

    b

    an

    b

    a

    xaxaaxf

    dxxfdxxfI

    10

    92

    9. Numerical Integration9. Numerical Integration9.1 Introduction

    Basic Approach Trapezoidal Concept

    There are two approaches in refining the approximate the integral: I th b f Increase the number of

    sections Use higher-order terms

    93

  • Rac 2015 20

    9. Numerical Integration9. Numerical Integration 9.1 Introduction

    94

    Multiple-section approach Higher-order-term approach

    9. Numerical Integration9. Numerical Integration9.2 Trapezoidal Rule (Linear)9.2.1 Basic Rule

    1

    1

    curvetheunderareathegconsiderin

    afbfabI

    axab

    afbfafxf

    dxxfdxxfIb

    a

    b

    a

    1

    1

    95

    3"121

    :degree) (secondError 2

    abfE

    ff

    t

  • Rac 2015 21

    9. Numerical Integration9. Numerical Integration9.2.2Multiple Section

    nab 1 1

    11

    11

    111

    11 1

    Error (summation of error at all sections, still 2nd

    n

    ii xfxfxfn

    abI1

    0 221

    1

    11 1

    1

    Derivation Eq. 21.8 & 21.9

    96

    degree):

    it fn

    abE "121 3

    9. Numerical Integration9. Numerical IntegrationProgramming realisation

    FUNCTION Trapm (h,n,f)sum = f0

    start

    DO I = 1, n-1sum = sum + 2* fi

    ENDDOsum = sum + fnTrapm = h*sum/2

    END Trapm

    97

    end

  • Rac 2015 22

    9. Numerical Integration9. Numerical Integration9.3 Simpsons Rule 1/3 (Quadratic)9.3.1 Basic Rule

    bb

    210

    2

    20

    2

    46

    polynomialLagrangeorderSecond;

    xfxfxfabI

    xfbxax

    dxxfdxxfIb

    a

    b

    a

    1

    4

    1

    But, third-order accuracy (see Box. 21.3)

    98

    )4(5

    5)4(

    2880

    2901

    fab

    abfEt

    9.3.2Multiple Aplication

    nn

    xfxfxfxfabI21

    24

    nj

    ji

    i xfxfxfxfnI

    ,...6,4,2,...5,3,10 243

    41

    4

    4

    4 4 1

    11 1

    1

    11

    11

    5

    )4(1

    abfE

    99

    290

    fEt

  • Rac 2015 23

    9.4 Simpsons 3/8 Rule9.4.1 Basic Rule

    bb

    Comparison from 1/3 rule: 3/8 third order approximation whilst 1/3 only second

    3210

    20

    3

    338

    ;

    xfxfxfxfabI

    bxax

    dxxfdxxfIaa

    100

    3/8 third order approximation, whilst 1/3 only second order but with the same level of accuracy

    1/3 rule requires 3 datapoints, whilst 3/8 4 datapoints For multiple application, 1/3 rule is used for no. of points:

    3, 5, 7, 9, , whilst 3/8 is used for no. of points: 4, 7, 10, 13 ,

    9.5 Composite methodIn order to adapt to the number of

    segments, integration can be g , gformed as a composite of various previously described methods, i.e. Simpsons 1/3, and Simpsons 3/8 rules

    101

  • Rac 2015 24

    9.6 Higher Order

    102

    9.7 Open Integrals

    103

  • Rac 2015 25

    *Text Book Problems: 21.1 and 21.3 21 9 21.9 21.18

    104

    10. Integration of Equations10. Integration of Equations10.1 Introduction

    Chapter 9 discusses methods to calculate the integral from a number of discrete datapoints, e.g. experimental resultsp , g p

    Basically, the methods discussed previously is still applicable. While not having datapoints, we have equation, so solve the equation for any input data, xi (Newton-Cotes)

    However, different strategies are preferable! Three approaches are available:

    Recursive Roombergs integration

    105

    Recursive Roomberg s integration Gauss-Quadrature Gauss-Legendre

  • Rac 2015 26

    10. Integration of Equations10. Integration of Equations Roombergs Integration

    Provides a way to combine two applications of the Trapezoidal rule with lower level of accuracy to compute a p y pthird estimate with higher accuracy

    Richardsons Extrapolation

    lmml

    m IIhhhII

    11

    2

    41212 2/14 hOhhforhIhII

    106

    812

    6

    1212

    8/631

    6364

    4/151

    1516

    2/33

    hOhhforIII

    hOhhforIII

    hOhhforhIhII

    lm

    lmlm

    10. Integration of Equations10. Integration of Equations Roombergs Integration

    Richardson Extrapolation: Example 22.1: I = integral estimate with 1 segment and Il = integral Im integral estimate with 1 segment, and Il integral

    estimate with 2 segment, can be combined to reach the third estimate:

    %6.16

    367467.11728.0310688.1

    34

    31

    34

    t

    lm III

    In general form:

    107

    144

    11,1,1

    1

    ,

    kkjkj

    k

    kj

    III j : more or less accurate integralk : level of integration

  • Rac 2015 27

    10. Integration of Equations10. Integration of Equations10.2 Gauss Quadrature

    Consider a linear approximation of numerical integration (Basic g (Trapezoidal). Observe the error!

    Now, by modifying the intersection of the area and the curve, the approximation could be more accurate!

    a b

    108

    ba? ?

    10. Integration of Equations10. Integration of Equations10.2.1 Gauss-Legendre (2-point)

    Systematic implementation of 2-point gauss quadrature to estimate third order integralg

    First, normalised the range of integration:a to b

    -1 to 1

    109

  • Rac 2015 28

    10. Integration of Equations10. Integration of Equations The method can approach up to cubic integrals:

    1

    0 1xy

    y

    xfcxfcI 4 unknowns (c0, c1, x0, x1)4 equations

    33

    22

    xyxy

    1100 xfcxfcI

    0

    21

    1

    110

    1

    110

    dxxbfcafc

    dxbfcafc

    4 equations

    ...5773505.03

    11

    0

    10

    x

    cc

    110

    032

    1

    1

    310

    1

    1

    210

    1

    dxxbfcafc

    dxxbfcafc ...5773505.03

    13

    1 x

    10. Integration of Equations10. Integration of Equations Step-by-step Application

    The integral variable, x, is transformed to new variable, xd:

    Consequently, the integral equation is transformed to using the above transformation relationship, to become:

    d

    d

    dxabdx

    xababx

    2

    2

    b

    1

    111

    Then, solve the integral using Gauss-Quadrature with known xo, x1, co, c1:

    dddda

    dxxfIdxxfI

    1

    1100 xfcxfcI dd

  • Rac 2015 29

    10. Integration of Equations10. Integration of Equations10.2.2 Gauss-Legendre (Higher points)

    nn xfcxfcxfcI 1100 With 2*(n+1) coefficients, it could solve system of

    polynomial equations for the order up to {2*(n+1)-1}, to give c0, c1, cn (weights), and x0, x1, xn (function arguments)

    Hence, accurate for polynomial with order up to {2*(n+1)-1}.

    nn1100

    112

    10. Integration of Equations10. Integration of Equations10.2.2 Gauss-Legendre (Higher points)

    113

  • Rac 2015 30

    10. Integration of Equations10. Integration of Equations 10.3 Improper Integrals

    114

    10. Integration of Equations10. Integration of Equations 10.3 Improper Integrals

    Transform infinite integration limit to finite limit (x 1/t)

    Set the datapoints at sufficiently close to infinity Use Open integral method, e.g. Midpoint method (Tab.

    21.4):

    ,11/1

    /12 badtt

    ft

    dxxfa

    b

    b

    a

    115

    12

    1 23

    23

    0

    n

    n

    ii

    x

    x

    xfxfxfhdxxfn

  • Rac 2015 31

    1111. . Numerical Numerical DifferentiDifferentiationation

    Use Finite-divided-difference to estimate f(x), f(x) f (x), ...

    Alternative Methods: Forward FDD: accuracy O(h) Fig. 23.1 Backward FDD: accuracy O(h) Fig. 23.2 Centered FDD: accuracy O(h2) Fig. 23.3

    Another alternative method to increase accuracy Richardson extrapolation

    116

    lmml

    m DDhhhDD

    11

    2

    1122. Differential Equations. Differential Equations12.1 Introduction

    Differential equations that will be solved are in form of:

    dy

    Recall the approximation by Taylor series:

    The numerical solution for the diff. equation solves for yi at

    yxfdxdy ,

    hyxfyy

    hdxdyyy

    iiii

    ii

    ,1

    1

    117

    q yieach desired input xi

    It requires one initial condition, x0. The method is then called Eulers method (linear)

  • Rac 2015 32

    1122. Differential Equations. Differential Equations Type of Problems to be solved:

    We know the slope at any point (dy/dx) Solve for each position y Solve for each position, y

    Example: Falling parachutist Free vibration

    118

    1122. Differential Equations. Differential Equations Problems:

    Truncation, due to discretization of x in predicting y, consisting of 2 parts:g p Local truncation error Propagated truncation error

    ...!3'''

    !2''' 321 h

    xfhxfhxfxfxf iiiii

    (truncated)

    119

    Round-off, caused by limited numbers of significant digits that can be retained by computer

  • Rac 2015 33

    1122. Differential Equations. Differential Equations Improvement (smaller step size)

    120

    1122. Differential Equations. Differential Equations Improvement (higher order)

    Midpoint method

    121

  • Rac 2015 34

    1122. Differential Equations. Differential Equations12.2 Higher order methods

    Heuns method: is used to extrapolate a Predictor yxfy ' is used to extrapolate a Predictor

    The slope at the predictor is calculated and then used to estimate a better general slope, as a Corrector to the previous slope (average)

    iii yxfy ,

    hyxfyy iiii ,0 1

    ''

    ,' 0 111

    iii yxfyhyyy '0

    122

    The next predicted result is, then: Or:

    2''' 1 ii yyy

    hyyy ii 11

    hyxfyxfyy

    hyxfyy

    iiiiii

    iiii

    2,,:Corrector

    ,:Predictor0

    111

    01

    1122. Differential Equations. Differential Equations Improvement (higher order)

    Heuns method

    123

  • Rac 2015 35

    1122. Differential Equations. Differential Equations12.3 Runge-Kutta

    Runge-Kutta methods are generalisation as well as extension of the previous two methods (Heuns dan Mid-p (point)

    The following general form, hence, can be used:

    n represents the order of approximation: second-order, thi d d t

    nn

    iiii

    kakakahhyxyy

    2211

    1 ,,

    124

    third-order, etc

    hkqhkqhkqyhpxfk

    hkqhkqyhpxfkhkqyhpxfk

    yxfk

    nnnnninin

    ii

    ii

    ii

    11,122,111,11

    22212123

    11112

    1

    ,,

    ,,

    ,

    1122. Differential Equations. Differential Equations Imagine, as in Heun and Midpoint, the algorithm contains

    two important steps: Calculation of p and q. Calculation of k

    Before actually calculating the next y Heun and Midpoint belong to second order Runge-Kutta

    (RK2), with certain p, q, k. Description Eq. 25.36 to 25.38

    125

  • Rac 2015 36

    1122. Differential Equations. Differential Equations Various types of Runge-Kutta:

    Second order (RK2):hkkyy 11

    hkyhxfk

    yxfk

    hkkyy

    ii

    ii

    ii

    12

    1

    211

    ,,

    22

    hkyhxfk

    yxfkhkyy

    ii

    ii

    ii

    12

    1

    21

    21,

    21

    ,

    (Heun)

    (Mid-point)

    126

    yf ii 12 2,

    2

    hkyhxfk

    yxfk

    hkkyy

    ii

    ii

    ii

    12

    1

    211

    43,

    43

    ,32

    31

    (Ralston)

    1122. Differential Equations. Differential Equations Third order (RK3):

    yxfk

    hkkkyy

    ii

    ii

    1

    3211

    ,

    461

    hkkkyy ii 3211 46

    1

    Fourth order (RK4):

    hkhkyhxfk

    hkyhxfk

    yxfk

    ii

    ii

    ii

    213

    12

    1

    2,21,

    21

    ,

    yxfk ii1 , hkkkkyy ii 43211 221

    6

    127

    hkyhxfk

    hkyhxfk

    hkyhxfk

    ii

    ii

    ii

    34

    23

    12

    ,21,

    21

    21,

    21

    hkkkkyy ii 43211 226

  • Rac 2015 37

    1122. Differential Equations. Differential Equations Graphical Description of Slope Modification in R-K

    128

    Heun (R-K 2) R-K 4

    1122. Differential Equations. Differential Equations Comparison

    129

  • Rac 2015 38

    1122. Differential Equations. Differential Equations Systems of ODE

    nyyyxfddy ,...,,, 2111

    nnn

    n

    n

    yyyxfdxdy

    yyyxfdxdydx

    ,...,,,

    ,...,,,

    21

    2122

    211

    0000

    130

    Initial condition:

    Selected: step size,

    002

    01

    0 ,...,,, nyyyx

    h

    BoundaryBoundary--value Problemvalue Problem Heat transfer: from hotter surface, T1, to cooler surface T2,

    in one-dimensional medium (rod)

    Known: Th, and Tc.

    Thot

    0'22

    xTThdx

    Tda

    Tcool

    131

    Find: temperature distribution at the medium

  • Rac 2015 39

    BoundaryBoundary--value Problemvalue Problem Solution Strategy#1: Shooting method

    xTThTd 0'2

    Steps:

    a

    a

    a

    TThdxdzz

    dxdT

    TThdxdT

    dxd

    xTThdx

    ';

    '

    02One 2nd order ODEbecomesTwo 1st ODEs (system of ODEs)

    132

    Assume z(0) calculate to find Tn if Tn known Tc, Assume z(0), Interpolate to find appropriate z(0) use for overall

    solution, T (x). Example 27.1

    BoundaryBoundary--value Problemvalue Problem Strategy #2: Finite difference

    0'2

    xTThTd

    Grid model:

    0'2

    0

    211

    2

    ia

    iii

    a

    TThx

    TTT

    xTThdx

    133

    T0=Th T1 T2 Tn = Tc

    x

  • Rac 2015 40

    BoundaryBoundary--value Problemvalue Problem For each step, build system of equation:

    1121012 0'20'2 h TThTTTTThTTT

    12 2112 21

    22123

    1212

    '20'2

    0'2

    00

    nannc

    nannn

    a

    aa

    TThx

    TTTTThx

    TTT

    TThx

    TTT

    TThx

    TThx

    Th = Hot temp(known)Th = Cold temp(known)

    134

    nnnn

    n

    b

    bb

    T

    TT

    a

    aaaaa

    2

    1

    1

    1

    0

    2212

    11211 Matrix of Linear Algebraic EquationSolve for Ts (temperatureDistribution)

    BoundaryBoundary--value Problemsvalue Problems Buckling

    Analytical Approach

    135

    0222

    2

    2

    2

    2

    ypdx

    ydEIPy

    dxyd

    EIM

    dxyd

  • Rac 2015 41

    BoundaryBoundary--value Problemsvalue Problems Analytical approach: Eigenvalue

    Numerical approach: Finite difference: Numerical approach: Finite difference:

    positionatcolumntheofdeflectionare

    02

    0

    22

    11

    22

    2

    ii

    iiii

    xy

    ypx

    yyy

    ypdx

    yd

    136

    above) Procedure Problems ValueBoundary (see

    position at column theofdeflection are

    ii xy

    Eigenvalue ProblemsEigenvalue Problems General Form

    0 XIA Possible solutions:

    {X} = 0, i.e. all x-s zero trival (useless) [[A]-[I]] = {0}, i.e. det [[A]-[I]] = 0 non-trivial, with

    usefull {X}

    Hence, the latter solution is sought after:d t [[A] [I]] 0 li i l f ( t f l i l

    137

    det [[A]-[I]] = 0 polinomial of (roots of polynomial search)

    Solve for i using methods of Muller or Bairstow, or even simpler methods as in Roots of equation problems.

  • Rac 2015 42

    Eigenvalue ProblemsEigenvalue Problems Alternate method: Power Method

    0

    XXA

    XIA

    Procedure:

    )for search (iterative

    1

    ii XAX

    XXA

    The result: the largest Eigenvalue.In order to obtain the smallest Eigenvalue,[A] [A]-1, with the result of (Eigenvalue)-1.

    1. Trial of {X}, and solve for [A]{X}2. Find and {Xnew}3. Feed {Xnew} for [A]{Xnew}4. Repeat the process until error is small enough

    138

    Eigenvalue ProblemsEigenvalue Problems Application #1: Mohrs Circle State of stress

    Find Principal Stresses:

    zzyzx

    yzyyx

    xzxyx

    ij

    02

    1

    xzxyx

    139

    stresses) (principal,,0

    0

    321

    322

    13

    2

    2

    IIIzzyzx

    yzyyx

    Root finding of Third order Polynomial Equation Problem

  • Rac 2015 43

    Eigenvalue ProblemsEigenvalue Problems Application #2: MDOF Vibration

    0F

    02

    02

    2122

    2111

    xxkxm

    xxkxm

    140

    First Approach: Mixed numerical-analytical Trial solution:

    tAx ii sin

    Eigenvalue ProblemsEigenvalue Problems

    tAx

    tAx

    ii

    ii

    sin

    sin2

    0sin2sinsin

    0202

    0sinsin2sin

    02

    212

    22

    2122

    212

    11

    212

    11

    2111

    tAtAktAmxxkxm

    AAkAmtAtAktAm

    xxkxm

    141

    02 21222 AAkAm

    00

    2

    2

    2

    1

    2

    22

    1

    2

    1

    AA

    mk

    mk

    mk

    mk

    Eigenvalue Problem

  • Rac 2015 44

    Eigenvalue ProblemsEigenvalue Problems Solution:

    Natural frequencies: 1 and 2 Mode Shape: A1 and A2 for each modep 1 2

    142

    Partial Differential EquationsPartial Differential Equations General Form

    0222

    DuCuBuA

    Classification

    022

    D

    yC

    yxB

    xA

    143

  • Rac 2015 45

    Math Function:

    Partial Differential EquationsPartial Differential Equations Elliptic Equations

    Example:

    Name : Laplace equationProblem: Find temperature

    022

    2

    2

    yT

    xT

    144

    Problem: Find temperature distribution over 2D areawith known boundaryvalues

    Partial Differential EquationsPartial Differential Equations Elliptic Equations

    Numerical Approach 022

    2

    2

    yT

    xT

    yx

    04:hence , grid, squareset weif

    022

    ,1,1,,1,1

    21,,1,

    2,1,,1

    bTa

    TTTTTyx

    yTTT

    xTTT

    jijijijiji

    jijijijijiji

    145

    ...

    T

    bTaTemp. Distribution over area

    Matrix of Linear Algebraic Equations!

  • Rac 2015 46

    Math Function:

    Partial Differential EquationsPartial Differential Equations Parabolic Equations

    Example:

    Name: Heat conduction equationP bl T t di t ib ti

    2

    2

    'xTk

    tT

    146

    Problem: Temperature distribution over a rod length atdifferent time

    Partial Differential EquationsPartial Differential Equations Parabolic Equations

    Numerical Approach

    2

    2

    'xTk

    tT

    lilililili

    li

    li

    li

    li

    li

    TTTTTxtk

    xTTTk

    tTT

    111

    2

    211

    1

    2

    ' :parameterconstant set the

    2'

    147

    T0=Th T1 T2 Tn = Tc

    x

  • Rac 2015 47

    Math Function:

    Partial Differential EquationsPartial Differential Equations Hyperbolic Equations

    Example:

    Wave equation

    2

    2

    22

    2 1ty

    cxy

    148