Lecture 3

18
NUMERICAL ANALYSIS Lecture -3 Muhammad Rafiq Assistant Professor University of Central Punjab Lahore Pakistan

description

EE Lec

Transcript of Lecture 3

  • NUMERICAL ANALYSIS

    Lecture -3

    Muhammad Rafiq

    Assistant Professor University of Central Punjab

    Lahore Pakistan

  • ERROR IN MULTIPLICATION

    Suppose exact value of a number be= x1

    Suppose exact value of another number be= x2

    Suppose approximate value of a number be= x1

    Suppose approximate value of another number be= x2

    Error in first number:e1=x1-x1

    Error in first number:e2=x2-x2

    Let Z be the product of two numbers=Z=x1.x2

    Let Z be the product of approximate values=Z=x1.x2

    Error=ez=Z-Z

  • = (x1.x2 )- (x1.x2)

    = x1.x2- (x1- e1)(x2-e2)

    =x1x2-( x1 x2- e1x2-e2x1-e1e2)

    = x1x2-( x1x2- e1x2-e2x1)

    Neglecting e1e2 as it is very small

    =x1x2-x1x2+e1x2+e2x1

    So

    ez =e1x2+e2x1

    Absolute error=|ez|=|e1x2+e2x1||e1x2|+|e2x1|

    And =|ez||e1x2|+|e2x1|

    Relative error= R.E=Absolute Error/|Z|

  • =|e1x2+e2x1|/|x1x2|

    =| e1x2 +e2x1/x1x2 |

    =| e1x2/x1x2 + e2x1/x1x2 |

    R.E=| e1/x1 + e2/x2|| e1/x1|+| e2/x2|

    So

    R.E| e1/x1|+| e2/x2|

    ERROR IN QUOTIENT

    Suppose exact value of a number be= x1

    Suppose exact value of another number be= x2

    Suppose approximate value of 1st number be= x1

    Suppose approximate value of 2nd

    number be= x2

  • Error in first number = e1=x1-x1

    Error in second number=e2=x2-x2

    Let Z be the quotient of two numbers=Z=x1/x2

    Let Z be the quotient of approximate values: Z=x1/x2

    Error=ez=Z-Z

    =x1/x2-x1/x2

    =x1/x2 - x1-e1/x2-e2

    = x1/x2 - x1(1-e1/x1)/x2(1-e2/x2)

    = x1/x2 -x1(1-e1/x1) x2(1-e2/x2)-1

    = x1/x2 - x1(1-e1/x1) x2(1- (-1 )e2/x2)

    [As (1+x)n=1+nx+]

  • = x1/x2-x1(1-e1/x1)x2(1+e2/x2)

    = x1/x2-x1x2 (1-e1/x1+e2/x2)

    = x1/x2-x1/x2+e1/x2-x1/x2e2

    = e1/x2 - x1/x22

    e2

    R.E=A.E/|Z|

    | e1/x2-x1/x22. e2|/|x1/x2|

    |(e1/x2-x1/x22. e2 )/ x1/x2|

    |e1/x1 - e2/x2||e1/x1| + |e2/x2|

    | | | | | |

  • ERROR IN POWER

    Let a number be=x

    Such that Z=xn

    Appraximate Value of x=x

    Error in x: e=x-x

    Error in Z: e=Z-Z

    =xn-(x)

    n

    =x

    n-(x-e)

    n

    =xn-x

    n(1 - e/x)

    n

    =xn-x

    n(1+n(-e/x))

    =xn-x

    n+nex

    n-1

  • So

    ez = nexn-1

    R.E=|nexn-1

    |/|xn|

    =| nexn-1

    /xn|

    =|ne/x|

    =|n||e/x|

    EXAMPLE # 1

    Given the data

    then estimate the relative error, maximum

    absolute error, the range in which true answers lie.

    Solution:

    Let x1=4.0643 e1=1/210-4

  • Let x2=37.487 e=1/210

    -3

    Z=x1/x2

    = 4.0643/37.487

    = 0.1084.

    R.E e1/x1 + e2/x2

    1/210-3/4.0643 + 1/210-3/37.487

    2.5640 10-5

    A.E R.E Z

    0.10842.564010-5

  • 2.77937610-6

    Max. Absolute Error=2.77937610-6

    The range in which true answer lies

    Z-A.E Z Z+A.E

    0.1084-2.779410-6Z0.1084+2.779410-6

    0.108397 Z 0.108402

    (Correct to 3 d.p)

    EXAMPLE # 2

    Given the data the estimate the relative error ,

    maximum Absolute error and the range in which answer lies.

  • Solution:

    Z=(48.425)1/2

    =6.9588.

    LET x=48.425 e=1/210-3

    R.E=n | |

    =1/2(110/248.425)

    =

    5.162610

    -6

    Maximum Absolute error = R.E Z

    =5.1626106.9588

    = 3.592510-5

  • The range in which true answers lie:

    Z-A.E Z Z+A.E

    6.9588- 3.5925 10

    -5 Z 6.9588- 3.5925 10-5

    6.9518 Z 6.9588

    (Correct to 2 d.p)

    EXAMPLE # 3

    If given numbers are rounded estimate the relative error and

    absolute error in the product 4.06430.37487

    Solution:

    Let x1=4.0643 e1=1/210-4

    Let x2=0.37487 e2=1/210-5

  • Let Z= x1 x2

    = 4.06430.377487

    = 1.52358.

    A.E : ez x1 . e2 + x2 . e1

    (4.06431/210-3

    )+(0.374871/210-4

    )

    3.906510-5

    R.E e1/x1 + e2/x2 |

    110-4

    / 24.0643 + 110-5

    / 20.37487

    2.5640 10-5

  • EXAMPLE # 4

    Given

    find relative error, absolute error and the

    range in which true answer lies.

    Solution:

    Z =

    =

    = (1.8778)1/2

    Z = 1.37034 n=1/2 e=1/210-4

    R.E1/21/210-4/1.8778

  • A.E 1.3313410-5

    R.E|Z |

    1.3313410-5 1.37034

    1.8243810-5

    Z-A.E Z Z+A.E

    1.37034-1.8243810-5Z 1.37034+1.8243810-5

    1.37032 Z 1.370358

    (correct to 4 d.p)

    EXAMPLE # 5.Let 65.43 and 17.0591 be correctly rounded to

    the number of digits shown. What is the smallest interval in

    which the exact sum of numbers lie.

  • SOL: x1=65.43 e1=1/210-2

    x2=17.0591 e2= 1/210-4

    Let Z=x1+x2

    =65.43+17.0591

    =82.4891.

    A.Eeze1+e2

    510-3+510-5

    510-3

    R.E A.E/|Z|

    510-3/|82.4891|

    6.0610-5

  • Z-A.E Z Z+A.E

    82.4891-510-3

    Z 82.4891+510-3

    82.4841 Z 82.4941

  • Exercise

    Q # 1:Given the data .Then estimate the

    relative error, maximum absolute error, the range in which true

    answers lies.

    Q #2:Given the data

    then estimate the relative error,

    maximum absolute error, the range in which true answers lie.

    Q # 3:Given

    find relative error, absolute error

    and the range in which true answer lies.

    Q #4:Given

    find relative error, absolute error

    and the range in which true answer lies.