Video 1: Error Definition Errors in Numerical Methods Every result - - PowerPoint PPT Presentation

video 1 error definition errors in numerical methods
SMART_READER_LITE
LIVE PREVIEW

Video 1: Error Definition Errors in Numerical Methods Every result - - PowerPoint PPT Presentation

Video 1: Error Definition Errors in Numerical Methods Every result we compute in Numerical Methods contain errors! We always have them so our job? Reduce the impact of the errors Main source of errors in numerical computation: Rounding


slide-1
SLIDE 1

Video 1: Error Definition

slide-2
SLIDE 2

Errors in Numerical Methods

— Every result we compute in Numerical Methods contain errors! — We always have them… so our job? Reduce the impact of the errors Main source of errors in numerical computation: — Rounding error: occurs when digits in a decimal point (1/3 = 0.3333...) are lost (0.3333) due to a limit on the memory available for storing one numerical value. — Truncation error: occurs when discrete values are used to approximate a mathematical expression (eg. the approximation sin $ ≈ $ for small angles $)
slide-3
SLIDE 3

Evaluating the Error

— How can we model the error? — Absolute error: — Relative error: x : true value

I

: approx .

I

= X tsx ea
  • II
  • x I
er = II
  • x I
  • 1×1
slide-4
SLIDE 4 — Absolute errors can be misleading, depending on the magnitude
  • f the true value &.
— For example, let’s assume an absolute error ∆" = 0.1 q" = 10! →

(accurate result)

q" = 10"! →

(inaccurate result)

— Relative error is independent of magnitude. 105 t O . I
  • 10
  • s

't

10 " e
slide-5
SLIDE 5 You are tasked with measuring the height of a tree which is known to be exactly 170 ft tall. You later realized that your measurement tools are somewhat faulty, up to a relative error of 10%. What is the maximum measurement for the tree height?
  • X
= 170ft er = lx

I

= ? I x I er = O
  • l
l x
  • I I
= er l X t

/

\

I

= x ( It er)

I

= x ( I
  • er)
  • 11=17011.17--187757
slide-6
SLIDE 6 You are tasked with measuring the height of a tree and you get the measurement as 170 ft tall. You later realized that your measurement tools are somewhat faulty, up to a relative error of 10%. What is the minimum height of the tree?-I=

170ft

er
  • O
  • l
X = ? ( X
  • r
→ Max ⇒ X -

Iota

  • - 188.8ft
er --lx 1×1

\×=

→ min ⇒ x - ¥ ,
  • - 'HIE
l ter
slide-7
SLIDE 7

Video 2: Significant Figures

slide-8
SLIDE 8

Significant digits

Significant figures of a number are digits that carry meaningful

  • information. They are digits beginning to the leftmost nonzero digit

and ending with the rightmost “correct” digit, including final zeros that are exact.

The number 3.14159 has _____ significant digits. The number 0.00035 has _____ significant digits. The number 0.000350 has ______ significant digits.
  • - -
  • . -
6
  • t
2

O

3
slide-9
SLIDE 9 Suppose # is the true value and $ # the approximation. The number of significant figures tells us about how many positions of % and & % agree. Suppose the true value is # = 3.141592653 And the approximation is # = 3.14 We say that 0 # has ______ significant figures of # Let’s try the same for: 2) 0 # = 3.14159 → We say that 0 # has ______ significant figures of # 3) 0 # = 3.1415 →We say that 0 # has ______ significant figures of # What happened here?

3

  • 6

4

slide-10
SLIDE 10

( " has ' significant figures of & if & − ( " has zeros in the first ) decimal

places counting from the leftmost nonzero (leading) digit of &, followed by a digit from 0 to 4. # = 3.14159 ⟶ # − 0 # = 0.000002653 # = 3.1415 ⟶ # − 0 # = 0.000092653 # = 3.1416 ⟶ # − 0 # = 0.000007347 # = 3.141592653

O

/

IX

  • I If 5×10
  • n

Aaa

→ I has 6 sigfigs of x
  • Lg
= 2.653×10-6 6 zeros

LAH

→ I has a sigfigsof X
  • W
  • 4 zeros

Is

= 0.92653 x 104

WH

→ I has 5 sgfigs of X

=

5 zeros

Lg

= 0.7347×10-5
slide-11
SLIDE 11 So far, we can observe that & − * & ≤ 5×10!". Note that the exact number in this example can be written in the scientific notation form & = 2×10#. What happens when the exponent is not zero? We use the relative error definition instead!
  • 3. 1415
. .
  • x 100
X = of#I = of x lots

IX

  • I I
= Iq
  • of l x IOP
er = I = 18-8^1×1515 5×1-5 "

f

5×10
  • n
I ql

loft

try

"

" o

slide-12
SLIDE 12 Accurate to ' significant digits means that you can trust a total of ' digits. Accurate digits is a measure of relative error. ) is the number of accurate significant digits Relative error: 34454 = $!"#$% !$#&&'(" $!"#$% ≤ 6×78!% In general, we will use the rule-of-thumb:

)*+,-./* *))0) ≤ 23"678

f 10

  • htt

M

slide-13
SLIDE 13 Rule-of-thumb:

)*+,-./* *))0) ≤ 23"678

A) For example, if relative error is 10!& then * & has at most ___ significant figures of & B) After rounding, the resulting number has 5 accurate digits. What is the tightest estimate of the upper bound on my relative error?

O

3

  • 2
  • htt

10

10
  • htt
=
  • 2
n =3
  • N - 5

ers lo

  • ht's lost
'

ers 10-4

slide-14
SLIDE 14

Video 3: Understanding Plots

slide-15
SLIDE 15
  • Power functions:
9 = : &' 9 = 4 and b = −2
  • bogey
) = logCaxb) = log Ca

) t log(xD

= logCa

) t b light

→If=FxItb

Z Z " O

..

slide-16
SLIDE 16
  • Power functions:
9 = : &' ; 9 = ; : + = ̅ &

=

is

.

O

E

' ↳

logCx) - I

slide-17
SLIDE 17
  • Exponential functions:
9 = : =( 9 = 4 and b = −1

log(g)

= logcab

D= logCa

) t log Cbt)

in

= logCa

) t

X logCb)

j

F

T F

  • O

x

slide-18
SLIDE 18
  • Exponential functions:
9 = : =( ; 9 = ; : + ; = & 9 = 4 and b = −1

=

f

is

×

slide-19
SLIDE 19

Video 4: Big-O notation

slide-20
SLIDE 20

Complexity: Matrix-matrix multiplication

For a matrix with dimensions 4 × 4, the computational complexity can be represented by a power function: 6789 = : 4> We could count the total number of operations to determine the value of the constants above, but instead, we will get an estimate using a numerical experiment where we perform several matrix-matrix multiplications for vary matrix sizes, and store the time to take to perform the operation.

N - lo - tie ? N
  • 20 → tee ?
i : i s c '
slide-21
SLIDE 21

For a matrix with dimensions 4 × 4, the computational complexity can be represented by a power function: 6789 = : 4> We can represent the power function above as a straight line using a log-log plot!

O

O

O

°
  • °

O

slide-22
SLIDE 22

Power functions are represented by straight lines in a log-log plot, where the coefficient ! is determined by the slope of the line.

?@AB = C D)

It

a

slope -b§fj%¥fgYs, = ( 2 log Clo) t l logo))
  • ¥3)login)

#'HI

  • DX
  • slope =3 →
a =3
slide-23
SLIDE 23 ?@AB = E(D) ) Instead of predicting time using ?@AB = C D) , we can use the big-O notation to write where 9 can be obtained from the slope of the straight line. For a matrix-matrix multiplication, what is the value of 9?
slide-24
SLIDE 24

We can also get the complexity by counting the number of

  • perations needed to perform the computation:

C- A XB

  • i. t
. n: l

J n multiplications

(Uh* Coil,

um

  • ÷:*
:

t

2h operations

NZ

entries in E

→ n' (2n) operations

ta¥@

slide-25
SLIDE 25

Big-Oh notation

Let ; and < be two functions. Then

! " = $ % " as " → ∞

If an only if there is a positive constant M such that for all sufficiently large values of ", the absolute value of ; " is at most multiplied by the absolute value of < " . In other words, there exists a value = and some "H such that:

! " ≤ ) % " ∀ " ≥ "!

n ①

  • e. HI
slide-26
SLIDE 26

Consider the function ! " = 2"" + 27" + 1000 " → ∞

Example:

dominant

Z

Z

3

If

I f

M (

)

x → a

"I Email ⇒

I

slide-27
SLIDE 27

Accuracy: approximating sine function

The sine function can be expressed as an infinite series: ? & = sin & = & − &) 6 + &* 120 − &+ 5040 + ⋯ (we will discuss these approximations later) Suppose we approximate ? & as D ?(&) = & We can define the error as: Or we can use the Big-O notation to say: G = ? & − D ?(&) = − &) 6 + &* 120 − &+ 5040 + ⋯

> = ? @I

O ⇐IDE

f

x → O

00

€⇐mUEe!del

slide-28
SLIDE 28

Big-Oh notation (continue)

Let ; and < be two functions. Then

! " = $ % " as " → 1

If an only if there exists a value = and some A such that:

! " ≤ ) % " ∀" 2ℎ454 0 < |" − 1| < 9

slide-29
SLIDE 29

Same example…

Consider the function ! " = 2"" + 27" + 1000 " → 0

f-G) € M (1000)

fH

slide-30
SLIDE 30

Iclicker question

Suppose that the truncation error of a numerical method is given by the following function: : ℎ = 5ℎ" + 3ℎ Which of the following functions are Oh-estimates of : ℎ as ℎ → 0

1) 2) 3) 4)

O

> 5h2t3hfM(5h)Xh→0

mm

  • 5h2t3hfM( h)
  • ch)r

5h2t3hfM(5ht3h) r

mm (

5hz+znSMCh7X

slide-31
SLIDE 31

Iclicker question

Suppose that the complexity of a numerical method is given by the following function: = > = 5>" + 3> Which of the following functions are Oh-estimates of = > as > → ∞

1) O(54J + 34) 2) O(4J) 3) O(4K) 4) O(4)

(

grow

O

  • ( 5h

't 3h )fM(5h73n) V

=

(5h

't 3h)fM(h2) ✓

  • (5h

't 3h )fm(w3)✓

TAT

(5kt 3h > SMH) X

slide-32
SLIDE 32

Video 5: Making predictions

[

A ]
  • [B)[
c] me 10,20 N = 105 , 108
slide-33
SLIDE 33 Suppose the computational complexity of a numerical method is given by O())). When ) = 1000, it was observed that the method takes 10 seconds to complete. You would like to run the same method for ) = 10000.What is an estimate of the time for completion of the larger problem? Check the course notes: Error - BigO Role of Constants

000

t

= a n ' N , = 1000

→ t ,

= 10 seconds nz =D "
  • ta = ?

tiene -

t.hn?-s/tz--fnnQIataItz=cnE

ta

)%qd!io4se

IT

B

slide-34
SLIDE 34

Video 6: Rates of convergence

slide-35
SLIDE 35

Rates of convergence

"##$#~ 1 '! 1) Algebraic convergence:

H: Algebraic index of convergence

A sequence that grows or converges algebraically is a straight line in a log-log plot.
  • r (
" #,

)*+"~'! Algebraic growth:

  • r ( '!
Demo “Exponential, Algebraic and Geometric convergence”
slide-36
SLIDE 36

Rates of convergence

"##$#~"$!# 2) Exponential convergence:

A sequence that grows or converges exponentially is a straight line in a linear- log plot.
  • r ( "$!#

)*+"~"!# Exponential growth:

  • r ( "!#
slide-37
SLIDE 37

Rates of convergence

Exponential growth/convergence is much faster than algebraic growth/convergence.