Download Error Measurement and Sequences

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Strähle construction wikipedia , lookup

Karhunen–Loève theorem wikipedia , lookup

Elementary mathematics wikipedia , lookup

Approximations of π wikipedia , lookup

Transcript
Error Measurement
and
Iterative Methods
Absolute & Forward Error
Relative Error
Cauchy Error
Errors and Estimates
In this course we will develop different algorithms to solve different types of
mathematical problems such as: solve an equation, find the value of and integral
or solve a differential equation. The algorithms we use will hardly ever find the
solution to such a problem but it will estimate the solution. This introduces an
error to what the algorithm proposes as a solution there are two different ways to
measure the error when the exact value of the solution is known.
absolute error  approximate value  exact value
approximate value  exact value
relative error 
exact value
* The relative error is not defined if the exact value is zero.
The absolute error tells you exactly how much your answer is off by and the
relative error tells you what percent your answer is off by.
Sequences
Many of the algorithms we will consider generate a sequence of values to
approximate a solution to a problem. A sequence is a succession of numbers. The
idea will often be to use the number in the sequence you are currently considering
to generate the next number in the sequence. Then next number will often be a
value that is “closer” to the solution of the problem you want to solve. For example,
we can use each of the sequence below to generate a value for the number e.
 1
xn  1  
 n
n
and
1 1 1
1
yn  1  1   

2 6 24
n!
In each of these sequences the larger the value for n the better the estimate for
the number e in both the absolute and relative measures.
Example of computing e accurate to 3 decimal places
Suppose we want to compute the number e accurate to 3 decimal places using
the sequence yn as our approximation.
1 1 1
1
e  11    
2! 3! 4!
n!
y0  1
1
2
1!
1
y2  y1   2.5
2!

y1  y0 
yn  yn 1 
1
n!
This is the sequence of values that will approximate e.
When will we need to stop to 3 decimal places of
accuracy?
This will be when the change from one step to another
will no longer change the 3rd decimal place assuming
all decimal places are not all 9's. Look for a value that
will not change the third decimal digit.
1
1

 .000198413
7! 5040
1
1 1
y 7  y 6   y5   
7!
6! 7!

1 1 1 1 1 1 1
 1         2.71825
1! 2! 3! 4! 5! 6! 7!
There are some standard ideas that describe
the error (i.e. achieve the accuracy you
want). In this case we need to take 7 terms
(or iterations of the algorithm) to get this
accuracy.
Iterative Methods
A numerical algorithms will very often use an iterative method to approximate a
solution to a given problem. An iterative method (sometimes referred to as
iteration or recursion) uses an existing approximation to generate a new and
hopefully better approximation to the solution.
These types of methods will most often have an initial approximation(s) for the
solution then an algorithm is applied to this to get a better approximation and this
continues until the desired accuracy (error) is achieved. We use the following
notation:
xn+1 = f(xn)
or
xn+1=f(xn,xn-1,…x1)
An immediate problem is that the approximation may never meet the prescribed
accuracy. To avoid the situation where the machine will do endless computations
we will often put a limit on the numbers of computations (iterations) we are willing
to let the machine work to find a solution.
Problem with Absolute and Relative Measures of Error
The problem with both the absolute and relative error measures we have talked
about is that to find them you need to know the answer. From a practical or
applied point of view why would be asking the question if you knew the answer?
Cauchy Error
To solve the problem of measuring the error without knowing the exact answer we
use what is known as the Cauchy Error for a sequence. The Cauchy Error is the
difference between any two terms of a sequence. The advantage here is that the
error is defined only using the sequence itself and not the answer. For a sequence
given by xn we define the two types of Cauchy Error below.
Cauchy Error  xm  xn
Standard Cauchy Error  xn 1  xn
Equations
The error measures used to measure
the error in approximating a solution
to an equation of the form 𝑓 𝑥 = 0 by
a number 𝑥𝑎 where the actual
solution is 𝑟 are the forward error and
the backward error.
Forward Error = 𝑟 − 𝑥𝑎
Backward Error = 𝑓 𝑥𝑎
𝑓 𝑥
𝑓 𝑥𝑎
𝑥𝑎
𝑟
𝑟 − 𝑥𝑎
Multiplicity of a root
If 𝑟 is a root of a function 𝑓 𝑥 , in other words 𝑓 𝑟 = 0 then the multiplicity of the root
𝑟 is the value 𝑛 so the first 𝑛 − 1 derivatives of 𝑓 𝑥 are zero at 𝑟, but the 𝑛𝑡ℎ
derivative is not zero.
Example:
The function 𝑓 𝑥 = 12 + 𝑥2 − 𝑥 the root 1 has multiplicity 2.
𝑓 1 = 12 + 12 − 1 = 0
𝑓 ′ 𝑥 = 12 − 2 1𝑥
𝑓 ′ 1 = 12 − 12 = 0
𝑓 ′′ 𝑥 = 14𝑥 −3
𝑓 ′′ 𝑥 = 14
2