Errors Scientific Notation In scientific notation , a number can be - - PowerPoint PPT Presentation

β–Ά
errors scientific notation
SMART_READER_LITE
LIVE PREVIEW

Errors Scientific Notation In scientific notation , a number can be - - PowerPoint PPT Presentation

Errors Scientific Notation In scientific notation , a number can be expressed in the form = 10 ! where is a coefficient in the range 1 < 10 and is the exponent. 1165.7 = 0.0004728 = Binary numbers We will


slide-1
SLIDE 1

Errors

slide-2
SLIDE 2

Scientific Notation

In scientific notation, a number can be expressed in the form 𝑦 = Β± 𝑠 Γ— 10! where 𝑠 is a coefficient in the range 1 ≀ 𝑠 < 10 and 𝑛 is the exponent.

1165.7 = 0.0004728 =

slide-3
SLIDE 3

Binary numbers

Β— We will soon be learning about how numbers are represented in

the computer.

Β— Before we introduce this new concept, make sure to revise binary

number representation. You will need to know how to convert form binary numbers to decimal numbers and vice-versa.

Β— To help you with the review, I added a PrairieLearn homework

assignment, where you can get extra credit points (counting towards the β€œshort questions”).

slide-4
SLIDE 4

Error 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 Β— How can we model the error?

Approximate result = True Value + Error

+ 𝑦 = 𝑦 + βˆ†π‘¦

Β— Absolute error: 𝑦 βˆ’ Μ‚

𝑦

Β— Relative error: 1 23

1

!

slide-5
SLIDE 5

Β— 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" β†’ .

𝑦 = 𝑦 + βˆ†π‘¦ = 10" + 0.1 (accurate result)

q𝑦 = 10#" β†’ .

𝑦 = 𝑦 + βˆ†π‘¦ = 10#" + 0.1 (inaccurate result)

Β— Relative error is independent of magnitude.

slide-6
SLIDE 6

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 (numbers rounded to 3 sig figs)? A) 153 ft B) 155 ft C) 187 ft D) 189 ft

slide-7
SLIDE 7

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 (numbers rounded to 3 sig figs) ? A) 153 ft B) 155 ft C) 187 ft D) 189 ft

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.

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 1 𝑦 = 3.14 We say that 1 𝑦 has ______ significant figures of 𝑦 Let’s try the same for: 2) 1 𝑦 = 3.14159 3) 1 𝑦 = 3.1415

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.

6 zeros 1 𝑦 = 3.14159 ⟢ 𝑦 βˆ’ 1 𝑦 = 0.000002653 = 2.653Γ—10!" ⟢ 1 𝑦 has 6 sf 5 zeros 1 𝑦 = 3.1415 ⟢ 𝑦 βˆ’ 1 𝑦 = 0.000092653 = 0.92653Γ—10!# ⟢ 1 𝑦 has 4 sf 6 zeros 1 𝑦 = 3.1416 ⟢ 𝑦 βˆ’ 1 𝑦 = 0.000007347 = 0.7347Γ—10!$ ⟢ 1 𝑦 has 5 sf 𝑦 = 3.141592653

slide-11
SLIDE 11

. 𝑦 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.

So far, we can observe that 𝑦 βˆ’ . 𝑦 ≀ 5Γ—10#7. Note that the exact number in this example can be written in the scientific notation form 𝑦 = π‘ŸΓ—108. What happens when the exponent is not zero?

We use the relative error definition instead!

𝑓" =

!# $ ! !

=

!# $ ! %Γ—'(! ≀ )Γ—'("#'(! %Γ—'(!

=

) % Γ—10#* ≀ 5Γ—10#*

slide-12
SLIDE 12

Accurate to n significant digits means that you can trust a total of n

  • digits. Accurate digits is a measure of relative error.

π‘œ is the number of accurate significant digits Relative error: 𝑓𝑠𝑠𝑝𝑠 =

!!"#$% "!#&&'(" !!"#$%

≀ 5Γ—10"#

In general, we will use the rule-of-thumb: 𝒇𝒔𝒔𝒑𝒔 = π’šπ’‡π’šπ’ƒπ’…π’– βˆ’ π’šπ’ƒπ’’π’’π’”π’‘π’š π’šπ’‡π’šπ’ƒπ’…π’– ≀ 𝟐𝟏#𝒐A𝟐

For example, if relative error is 10!% then 1 𝑦 has at most 3 significant figures of 𝑦

slide-13
SLIDE 13

After rounding, the resulting number has 5 accurate digits. What is the tightest estimate of the upper bound on my relative error?

A) 10" B) 10#" C) 10C D) 10#C

slide-14
SLIDE 14

Sources of Error

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

  • n 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-15
SLIDE 15

Let’s first talk about plots…

slide-16
SLIDE 16
  • Power functions:

𝑧 = 𝑏 𝑦$ log 𝑧 = log 𝑏 𝑦$ = log 𝑏 + log 𝑦$ = log 𝑏 + b log 𝑦 K 𝑧 = K 𝑏 + 𝑐 Μ… 𝑦

slide-17
SLIDE 17
  • Exponential functions:

𝑧 = 𝑏$% log 𝑧 = log 𝑏$% = 𝑐 𝑦 log 𝑏 K 𝑧 = K 𝑐 𝑦

slide-18
SLIDE 18

Big-O notation

slide-19
SLIDE 19

Complexity: Matrix-matrix multiplication

For a matrix with dimensions π‘œ Γ— π‘œ, the computational complexity can be represented by a power function: 𝑒𝑗𝑛𝑓 = 𝑑 π‘œD 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.

slide-20
SLIDE 20

For a matrix with dimensions π‘œ Γ— π‘œ, the computational complexity can be represented by a power function: 𝑒𝑗𝑛𝑓 = 𝑑 π‘œD What type of plot will result in a straight line? A) semilog-x B) semilog-y C)log-log

slide-21
SLIDE 21

Demo: Cost of Matrix-Matrix Multiplication

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

𝑒𝑗𝑛𝑓 = 𝑑 π‘œ&

slide-22
SLIDE 22

Demo: Cost of Matrix-Matrix Multiplication 𝑒𝑗𝑛𝑓 = 𝑃(π‘œ& ) Instead of predicting time using 𝑒𝑗𝑛𝑓 = 𝑑 π‘œ& , we can use the big-O notation to write where 𝑏 can be obtained from the slope of the straight line. For a matrix-matrix multiplication, what is the value of 𝑏?

slide-23
SLIDE 23

As we mentioned previously, we can also get the complexity by counting the number of operations needed to perform the computation:

slide-24
SLIDE 24

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 𝑦8 such that:

𝑔 𝑦 ≀ 𝑁 𝑕 𝑦 βˆ€ 𝑦 β‰₯ 𝑦*

slide-25
SLIDE 25

Consider the function 𝑔 𝑦 = 2𝑦+ + 27𝑦 + 1000 When 𝑦 β†’ ∞, the term 𝑦+ is the most significant, and hence, 𝑔 𝑦 = 𝑃(𝑦+)

Example:

slide-26
SLIDE 26

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 P 𝑔(𝑦) = 𝑦 We can define the error as: Or we can use the Big-O notation to say: 𝐹 = 𝑔 𝑦 βˆ’ P 𝑔(𝑦) = βˆ’ 𝑦& 6 + 𝑦' 120 βˆ’ 𝑦( 5040 + β‹―

𝑭 = 𝑷 π’šπŸ’

slide-27
SLIDE 27

Big-Oh notation (continue)

Let 𝑔 and 𝑕 be two functions. Then

𝑔 𝑦 = 𝑃 𝑕 𝑦 as 𝑦 β†’ 𝑏

If an only if there exists a value 𝑁 and some πœ€ such that:

𝑔 𝑦 ≀ 𝑁 𝑕 𝑦 βˆ€π‘¦ π‘₯β„Žπ‘“π‘ π‘“ 0 < |𝑦 βˆ’ 𝑏| < πœ€

slide-28
SLIDE 28

Same example…

Consider the function 𝑔 𝑦 = 2𝑦+ + 27𝑦 + 1000 When 𝑦 β†’ 0, the constant 1000 is the dominant part of the

  • function. Hence,

𝑔 𝑦 = 𝑃(1)

slide-29
SLIDE 29

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) Mark the correct answer: A) 1 and 2 B) 2 and 3 C) 2 and 4 D) 3 and 4 E) NOTA

slide-30
SLIDE 30

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 π‘œ β†’ ∞

Mark the correct answer: A) 1,2,3 B) 1,2,3,4 C) 4 D) 3 E) NOTA

1) O(5π‘œP + 3π‘œ) 2) O(π‘œP) 3) O(π‘œQ) 4) O(π‘œ)

slide-31
SLIDE 31

Select the function that best represents the decay of the error as π‘œ increases

A) 𝑓!"# B) 𝑓!# C) π‘œ!$ D) π‘œ!"

slide-32
SLIDE 32

Rates of convergence

𝑓𝑠𝑠𝑝𝑠~ 1 π‘œ+ 1) Algebraic convergence:

𝛽: 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-33
SLIDE 33

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-34
SLIDE 34

Rates of convergence

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