Professional Documents
Culture Documents
FG=CSF ( 35 ) + MG ( 35 )+ FE (30 )
By rearranging, we find that the numerical error is equal to the discrepancy between the truth
and the approximation, as in
TRUE ERROR
where Et is used to designate the exact value of the error. One way to account for the
magnitudes of the quantities being evaluated is to normalized the error to the true value, as in
error
true value
the relative error can also be multiplied by 100 percent in order to express it as
t=
true error
x 100
true value
TRUE PERCENT
RELATIVE ERROR
Example: Suppose that you have the task of measuring the length of a bridge and a rivet and
come up with 9,999 and 9 cm, respectively. If the true values are 10,000 and 10 cm respectively
compute for a. the error b. the percent error for each case.
Solution:
a. Computing for the error of bridge
Et =10,0009,999=1 cm
Et =109=1 cm
t=
1
x 100 =0.01
10,000
t=
1
x 100 =10
10
Thus, although both measurement s have an error of 1 cm, the relative error for the rivet is much
greater. We would conclude the we have done adequate job of measuring the bridge, where as
our estimate for rivet leaves something to be desired.
An alternative is to normalize the error using the best available estimate of the true value, that
is, to approximation itself,
a=
approximation error
x 100
approximation
a=
Often, when performing computations, we may not be concerned with the sign of the error but
are interested in whether the absolute value is lower than a pre-specified tolerance
s .
| a|< s
If this relationship holds, our result is assumed to be within the pre-specified acceptable level
s .
s =( 0.5 x 1 02n )
Example: In mathematics, function can often be represented by infinite series, for example, the
exponential function can be computed using
e x =1+ x +
x 2 x3
xn
+ + ..+
2! 3 !
n!
Thus, as more terns are added in sequence, the approximation becomes a better and better
estimate of the true value of
0.5
0.5
n=3
simply equal to 1. The second is then generated by adding the second term,
e 1+ x
x=0.5
Or for
e 1+0.5=1.5
Solving for the true percent relative error gives
t=
1.6487212711.5
x 100 =9.02
1.648721271
a=
because
another term,
Ter
m
1
2
3
4
5
6
1.51
x 100 =33.3
1.5
x2
2 ! , and repeat the error calculations. The process is continued until
Result
1
1.5
1.625
1.6458333
33
1.6484375
00
1.6486979
17
39.3
9.02
1.44
0.175
33.3
7.69
1.27
0.0172
0.158
0.00142
0.0158
| a|< s
Round-off Errors
The result when approximate numbers are used to represent exact numbers. Numbers
such as
,e , 7
they cannot be represented exactly by the computer. The discrepancy introduced by this
omission of significant figures is called round-off error.
Computer representation of numbers
Numerical round-off errors are directly related to the manner in which numbers are stored
in a computer. The fundamental unit whereby information is represented is called a word. This is
an entity that consists of a string of binary digits, or bits. Numbers are typically stored in one or
more words. To understand how this is accomplished, we must first review some material related
to number system.
Number system is merely a way of representing numbers.
Base-10 number system is a number used as a reference for constructing the system. It uses ten
digits, from 0-9.
Example: If we have the number 86,409 then we have eight groups of 10,000, six groups of
1,000, four groups of 100, zero for 10, and nine more units, or
( 1 x 21 ) + ( 1 x 20 ) =2+ 1=3
Example: find the binary number 10101101 is equivalent to the decimal number 173.
Solution:
2 128 x 1=128
6
2 64 x 0=0
5
2 32 x 1=32
4
2 16 x 0=0
23 8 x 1=8
22 4 x 1=4
21 2 x 0=0
20 1 x 1=
1__
173
Integer Representation employs the first bit of a word to indicate the sign, with a 0 for positive
and a 1 for negative, called signed magnitude method.
For example, the inter value of -173 would be stored on a 16-bit computer
1 0 0 0 0 0 0 0 1 0 1 0 1 1 0 1
Sign
Range integers
Example: Determine the range of the integers in base-10 system that can be represented on a
16-bit computer.
Solution: consider 01111111111111111 and is equivalent to decimal, note the first digit is a
sign
dv v v ( t i+1 ) v(t i )
dt t
t i+1 t i
A truncation error was introduced into the numerical solution because the difference equation
only approximates the true value of the derivative. In order to gain insight into the properties of
such errors, we now turn to a mathematical formulation that is used widely in numerical methods
to express functions in a approximate fashion Taylor Series.
The Taylor Series
A useful way to gain insight into the Taylor Series is to build it term by term, the first term
in the series is
f ( xi +1) f (x i)
This relationship, which is called the zero-order approximation, indicates that the value of
at the new point is the same as the value at the old point.
Additional terms of the Taylor Series are required to provide a better estimate, the firstorder approximation is developed by adding another term yield:
f ( xi )
2
f ( x i+1 ) f ( x i ) +f ( x i )( xi +1x i )+
( x i+1x i )
2!
'
f ( xi )
f ( xi )
2
n
f ( x i+1 ) f ( x i ) +f ( x i )( xi +1x i )+
x i+1x i ) ++
(
( xi +1x i ) + Rn
2!
n!
'
Thus,
f (n+1 ) ( )
n+1
R n=
x i+1 xi )
(
(n+1)!
It is often convenient to simplify the Taylor Series by defining a step size
expressing
''
f ( xi ) 2
f ( xi ) n
f ( x i+1 ) f ( x i ) +f ( x i ) h+
h + +
h + Rn
2!
n!
'
where
Rn
(n+1 )
( ) n+1
f
R n=
h
(n+1)!
Example: Use zero-through fourth-order Taylor Series expansion to approximate the function
4
x i=0
Solution:
f(x
f(xi)
with
ZeroFirst-
f ( x ) between 10
Second-
f ( 0 )=1.2
x i+1=1
True
n=0
f (xi +1)1.2
xi=0
xi+1=1
x
n=1
Et =0.21.2=1.0
x=1
At
For
x i=0
f ( 1 )=0.95 ;
Thus,
f ( x i+1 ) 1.20.25 h
Et =0.20.95=0.75
x=1
At
For
''
x i=0
h=1 ,
f ( 1 )=0.45 ;
Et =0.20.45=0 .25
Continuing the process will lead in exact the same equation as we started with:
f ( ) 5
R4 =
h
5!
Thus, because the fifth derivative of a fourth-order polynomial is zero,
At
x i+1=1 :
R4 =0
n=0
to 6 to approximate
is
f ( x )=cos x
x i+1=
At
f ( x)
h= =
3 4 12 .
means that
Solution:
( 3 ) cos 4 =0.707106781
t=
0.50.707106781
x 100 =41.4
0.5
f ' ( x )=sin x
Which has
12
cos
sin
4
4 12
2!
f
cos
3
()
t =0.449
Order n
f n( x)
f( )
3
cos x
-41.4
-sin x
-cos x
sin x
cos x
0.70710678
1
0.52198665
9
0.49775449
1
0.49986914
7
0.50000755
1
-4.4
0.449
2.62x10-2
-1.51x10-3
x i=
-sin x
-cos x
0.50000030
4
0.49999998
8
-6.08x10-5
2.40x10-6
v (t ) velocity , thus
v ' ( ti ) =
v ( t i +1) v( t i )
R1
t i+1t i
t i+1t i
First-order approximation
Truncation error
''
R1
v ( )
=
(t t )
t i+1 t i
2 ! i +1 i
Thus
or
R1
=0 (t i +1t i )
t i+1 t i
f ( x )=x m
for
m=1,2,3,4
over the
x=1 2 .
range from
m=1
Solution:
m=
15
f ( x i+1 ) f ( x i ) +m x m1
h
i
m=
10
m=
5
''
R 1=
' ''
f ( x i ) 2 f ( xi ) 3
h+
h
2!
3!
m=
1
1
f ( 2 )=1+1 ( 1 )=2
and
x=2
R1=0
is 2.
The remainder is zero because the second and higher derivatives of a linear function are zero.
Thus, as expected, the first-order Taylor Series expansion is perfect when underlying function is
linear.
For
f ( 2 )=22=4 .
f ( 2 )=1+2 ( 1 )=3
and
2
R1= ( 1 )2 +0+0+ =1
2
Thus, because the function is a parabola, the straight-line approximation results in a discrepancy.
Note that the remainder is determined exactly.
For
f ( 2 )=23 =8 .
f ( 2 )=1+3 ( 1 )2 ( 1 )=4
and
6
6
R1= ( 1 )2 + ( 1 )3 +0+ =4
2
6
For
f ( 2 )=24=16 .
f ( 2 )=1+ 4 ( 1 )3 (1 ) =5
and
R 1=
12 2 24 3 24 4
( 1 ) + ( 1 ) + ( 1 ) + 0+=11
2
6
24
Observe that R1 increases as the function becomes nonlinear this permits a complete
determination of the Taylor Series remainder.
We will examine
size
f ( x )=x m
m=4
is varied.
f ( x i+1 ) f ( x i ) +4 x 3i h
if
x i=1 ,
f ( x )=1
f ( 1+h ) =1+ 4 h
With a remainder of
R1=6 h 2+ 4 h3 + h4
Bracketing Methods
Equations deals with methods that exploit the fact that a function typically changes sign in
the vicinity of a root. These techniques are called bracketing methods because two initial
guesses for the root are required. As the name implies, these guesses must bracket or be on
either side of, the root.
Graphical Methods
f ( x )=0
is to make
a plot of the function and observe where it crosses the x axis. This point, which represents the x
parachutist of mass
Given:
t=10
v =40
g=9.8
m=68.1
m
s
needed for a
t=10 s .
9.8 m/s 2 .
40
( ) t
gm
v ( t )=
1e m v (10)
c
( ) t
gm
f ( c )=
1e m f (10)
c
(
9.8(68.1)
)10
f ( c )=
1e 68.1 40
c
f ( c )=
667.38
[1e0.146843 c ]40
c
f (c)
4
8
12
16
20
34.115
17.653
6.067
-2.269
-8.401
20
10
Applying
f ( 14.75 )=
8
4 Root=14.
12
-10
c=14.75
667.38
[1e0.146843(14.75) ]40=0.059
14.75
14.75
(
)10
9.868 .1
v=
1e 68.1 =40.059
14.75
16
20
The bisection method, which is alternative called binary chopping, interval halving, or
Bolzanos method, is on type of incremental search method in which the interval is always
divided in half. If a function changes sign over an interval, the function value at the midpoint is
evaluated. The location of the root is then determined as lying at the midpoint of the subinterval
within which the sign changes occur. The process is repeated to obtain refined estimates.
An algorithm for bisection
Step 1: Choose lower
xl
and upper
xr
is determined by
x r=
f (xl )f ( x u )< 0 .
x l+ x u
2
Step 3: Make the following evaluations to determine in which subinterval the root lies:
a. If
f (xl )f (x u )<0
u= x r
x
and return
l= x r
x
and return
to Step 2.
b. If
f (xl )f (x u )>0
to Step 2.
c. If
f ( x l ) f ( x u )=0