olortegui 2.pdf

20
7/25/2019 OLORTEGUI 2.pdf http://slidepdf.com/reader/full/olortegui-2pdf 1/20 Numerical Methods Applied to Mechatronics Lecture No 3 Escuela de Ingeniería Mecatrónica Universidad Nacional de Trujillo ROUNDOFF AND TRUNCATION ERRORS Dr. Jorge A. OlorteguiYume Ph.D.

Upload: jesus-correa-ayala

Post on 24-Feb-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 1/20

Numerical Methods Applied to Mechatronics

Lecture No 3Escuela de Ingeniería Mecatrónica

Universidad Nacional de Trujillo

ROUNDOFF AND TRUNCATIONERRORS

Dr. Jorge A. Olortegui Yume Ph.D.

Page 2: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 2/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.2

COURSE PROJECTSThe dimensions of the planar mechanisms, shown in the Figures are given in theTables which go along with them. The angle of the driver link 1 with the horizontal

axis is φ . The constant angular speed of the driver link 1 isn

and is given in thetables.

Page 3: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 3/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.3

COURSE PROJECTS

Page 4: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 4/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.4

PROJECT No 1

Page 5: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 5/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.5

PROJECT No 2

Page 6: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 6/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.6

PROJECT No 3

Page 7: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 7/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.7

ACCURACY AND PRECISION

Accuracy

How closely computed /measured value agreeswith true value

Precision (Reproducibility)

How closely computed /measured values agreewith each other.

inaccurate

and imprecise

accurate andimprecise

inaccurate andprecise

accurate andprecise

Page 8: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 8/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.8

ERROR DEFINITIONS

• True error ( E t): Difference between true

value and approximation.

• Absolute error (| E t |): Absolutedifference between true value andapproximation.

• True fractional relative error: True errordivided by the true value.

• Relative error ( t): True fractionalrelative error in percentage.

approxtruet V V E

approxtruet V V E

true

approxtrue

true

t fract t V

V V

V E

100100 true

approxtrue

true

t t V

V V

V E

Page 9: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 9/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.9

ERROR DEFINITIONSActual Error Determination

Previous definitions rely on knowing a true value• Having a true value is illogical/rare

approximations to true valuee.g. : the relative error ( t) is approximated as:

• Challenge: Find adequate “ E approx .”

at

100

approx

approxa V

E

100100 approx

approxtrue

approx

approxa

V

V V

V

E

Don´t know “V true ”

Page 10: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 10/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.10

ERROR DEFINITIONSActual Error Determination (cont´d)

• Challenge: Find adequate “ E approx .”

Example: Iterative calculations

100

present

previous present a V

V V

Page 11: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 11/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.11

ERROR DEFINITIONSStoping Criterion

Repeat calculations until:

Where: s : Prespecified error tolerance

sa

Page 12: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 12/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.12

ERROR DEFINITIONSRoundoff Error• Roundoff errors arise because digital computers

cannot represent some quantities exactly. Thereare two major facets of roundoff errors involved

in numerical calculations: – Digital computers have size and precision limits on

their ability to represent numbers. – Certain numerical manipulations are highly sensitive

to roundoff errors.

TRABAJO DOMICILIARIO

Page 13: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 13/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.13

ERROR DEFINITIONSTruncation Errors• Result from using an approximation in place of an exact mathematical procedure.

Example 1 : Approximation to a derivative using a finite-difference equation:

dv

dt

v

t

v(t i 1) v(t i )

t i 1 t iGain insight in error calculation use Taylor s Series.

Taylor´s theorem: Any smooth function can be approximated as apolynomial.

f xi 1 f xi f ' xi h f '' xi

2!h 2 f (3) xi

3!h 3

f (n ) xi n!

h n Rn

Rn : Remainder

Page 14: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 14/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.14

ERROR DEFINITIONSTruncation ErrorsExample 1 (cont´d):

Taylor´s theorem:

f xi 1 f xi f ' xi h f '' xi

2!h 2 f (3) xi

3!h 3

f (n ) xi n!

h n Rn

• Usually, the nth order Taylorseries expansion will be exactfor an nth order polynomial.

• In other cases, the remainderterm Rn is of the order of hn+1 ,meaning:

– More terms used less error – Smaller spacing, smaller

error for a given number ofterms.

Page 15: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 15/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.15

ERROR DEFINITIONSTruncation ErrorsExample 1 (cont´d): Applying to the case of velocity

Taylor´s theorem:

nn

ni

nii

iii Rt

ndt

t vd

t dt t vd

t dt t vd

t dt

t dvt vt v

!!3!2

33

3

22

2

1

t R

t n

dt t vd

t dt t vd

t dt t vd

dt t dv

t t vt v nn

ninii

iii 123

3

2

2

1

!!3!2

ii t t t Donde 1:

t t vt v

t R

t ndt

t vd

t dt

t vd

t dt

t vd

dt t dv

iinnn

in

ii

i 112

3

3

2

2

!!3!2

t

t vt vt O

dt t dv iii 12n For

Page 16: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 16/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.16

ERROR DEFINITIONSTruncation ErrorsExample 1 (cont´d): Applying to the case of velocity

Taylor´s theorem: ii

iii

t t t vt v

t Odt

t dv

1

1

TRUNCATION ERROR with order of magnitude “ t ”

Note that TRUNCATION ERROR depends on:

• “n”• “ t ”• Whether we have approxs. for 2nd, 3rd, … derivatives of function

Page 17: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 17/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.17

ERROR DEFINITIONSTruncation ErrorsApplication: Numerical Differentiation

• The first order Taylor series can be used to calculateapproximations to derivatives:

– Given:

– Then:

This is termed a “forward” difference because it utilizes data ati and i +1 to estimate the derivative.

f ( xi 1) f ( xi ) f '( xi )h O(h 2 )

f '( xi ) f ( xi 1) f ( xi)

hO(h)

Page 18: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 18/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.18

ERROR DEFINITIONS

Truncation ErrorsApplication: Numerical Differentiation

• There are also backward difference and centereddifference approximations, depending on thepoints used:

• Forward:

• Backward:

Centered:

f '( xi ) f ( xi 1) f ( xi)h O(h)

f '( xi) f ( xi ) f ( xi 1)

hO(h)

f '( xi ) f ( xi 1) f ( xi 1)

2hO(h 2 )

Page 19: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 19/20

Page 20: OLORTEGUI 2.pdf

7/25/2019 OLORTEGUI 2.pdf

http://slidepdf.com/reader/full/olortegui-2pdf 20/20

Roudoff and Truncation Errors Dr. Jorge A. Olortegui Yume Ph.D.20

ERROR DEFINITIONS

Other Error types

• Blunders - errors caused by malfunctions of the computer orhuman imperfection.

• Model errors - errors resulting from incomplete mathematicalmodels.

• Data uncertainty - errors resulting from the accuracy and/or

precision of the data.