0% found this document useful (0 votes)
19 views5 pages

Introduction To Numeria Analysis ST Sept 15th

200l notes

Uploaded by

22u4356
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views5 pages

Introduction To Numeria Analysis ST Sept 15th

200l notes

Uploaded by

22u4356
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Lecture Note: FLOATING POINT REPRESENTATION OF NUMBERS

There are two types of arithmetic operations available in a computer. They are:
I. Integer Arithmetic
II. Real or Floating-Point Arithmetic.
Integer Arithmetic deals with integer operands and is used mainly in counting and as subscripts.
Real Arithmetic uses numbers with fractional parts as operands and is used in most computations.
Computers are usually designed such that each location, called words, in memory stores only a
finite number of digits. Consequently, all operands in Arithmetic operations have only a finite
number of digits.
One method of representing real numbers in computer would be to assume a fixed position for
the decimal point and store all numbers after appropriate shifting, if necessary, with an assumed
decimal point.
+ One memory location or word
5 6 5 2 3 1

Assumed decimal point position


A memory location storing number 5652.31
For this, a new convention is adopted that aims to preserve the maximum number of significant
digits in a real number and also increase the range of values of real numbers stored. This
representation is called the normalized floating-point mods of representing and storing real
numbers
In this mode, a real number is expressed as a combination of a mantissa and exponent. The
mantissa is made less than 1 ≥ .1 and the exponent is the power of 10 which multiplies the
mantissa (which is the fractional part of a common logarithm representing the digits of the
associated number but not its magnitude)
For Example: The mantissa of 2.4771 is .4771. The number 43.76 x 106 is represented in this
notation as 4376E8, where E8 is used to represent 108. The mantissa is .4376 and the exponent is
8.
Moreover, the shifting of the mantissa to the left until its most significant digit is non-zero in
called normalization.
For Example: The number .006831 may be stored as .6831E-2, because the leading zeros serve
only to locate the decimal point.
ARITHMETIC OPERATION WITH NORMALIZED FLOATING-POINT NUMBERS.
1) Addition and Subtraction
If two numbers represented in a normalized floating point notation are to be added, the
exponents of the two numbers must be made equal and the mantissa shifted appropriately,
Thus, the principles are the same.
Examples: ….
EXERCISE
1. Add the following floating point numbers:
i. 0.6434E3 and 0.4845E3.
ii. 0.6434E99 and 0,4845E99.
2. Apply the procedure for the following multiplication:

1
i. 0.1111E51 x 0.4444E50
3. Find the solution of the following equation using floating point arithmetic with a 4-digit
mantissa.
𝑥 2 − 1000𝑥 + 25 = 0
Give comments or the result so obtained.

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATION


Consider the equation of the form 𝑓 (𝑥) = 0.
If 𝑓 (𝑥) is a quadratic, cubic, biquadratic expression, then algebraic formulae are available for
expressing the root. But when 𝑓 (𝑥) is a polynomial of higher degree or an expression involving
transcendental functions, for example, 1 + cos 𝑥 − sin 𝑥, 𝑥 tan 𝑥 − cosh 𝑥, 𝑒 −𝑥 − sin 𝑥, etc.,
algebraic methods are not available.
We shall describe some numerical methods for the solution of 𝑓(𝑥) = 0, where 𝑓 (𝑥) is algebraic or
transcendental or both.

BISECTION (0R BOLZANO) METHOD


This method is based on the repeated application of intermediate value property.
Let the function 𝑓 (𝑥) be continuous between 𝑎 and 𝑏, for definiteness:
1
Let 𝑓 (𝑎) be (-)ve and 𝑓 (𝑏) be (+)ve. Then the first approximation of the roots is 𝑥1 = (𝑎 + 𝑏).
2

If 𝑓 (𝑥1 ) = 0, then 𝑥, is a root of 𝑓 (𝑥) = 0, otherwise the root lies between 𝑎 and 𝑥1 , or 𝑥1 and 𝑏,
according to 𝑓 (𝑥1 ) is (+)ve 0r (-)ve. Then we bisect the interval as before and continue the process
until the root is found to the desired accuracy.

In the adjoining figure, 𝑓 (𝑥1 ) is (+)ve so that the root lies between 𝑎 and 𝑥1 . The second
1
approximation of the root is 𝑥2 = (𝑎 + 𝑥1 ). If 𝑓 (𝑥2 ) is (-)ve the root lies between 𝑥1 and 𝑥2 . The
2
1
third approximation to the root is 𝑥3 = (𝑥1 + 𝑥2 ) and so on.
2

EXAMPLE ….

Exercises
(1) Use the bisection method to find a root of the equation 𝑥 3 − 4𝑥 − 8.95 an accurate to
three decimal places, given that the roots lies between 2 and 3.
(2) Find a positive real root of a𝑥 − 𝑐𝑜𝑠𝑥 = 0 by bisection method, correct up to 4 decimal
places between 0.73 and 0.74.Type equation here.
(3) Find a real root of the equation 𝑥 3 − 2𝑥 − 5 = 0 using bisection method. Use (0,1)

Iteration method (successive approximations method)


To find the roots of the equation 𝑓 (𝑥) = 0 by successive approximations, we write it in the form
𝑥 = ∅ (𝑥 ) .
The roots of 𝑓 (𝑥) = 0 are the same as the points of intersection of the straight line 𝑦 = 𝑥 and
the curve representing 𝑦 = ∅(𝑥).

Let 𝑥 = 𝑥0 be an initial approximations of the desired root 𝛼, then first approximations of 𝑥1 is


given by
2
𝑥1 = ∅(𝑥0 )
Now, treating 𝑥1 as the initial value, the second approximations is
𝑥2 = ∅(𝑥1 )
Proceeding in the way, the nth approximations is given by
𝑥𝑛 = ∅(𝑥𝑛−1 ).
Sufficient condition for convergence of iterations
It is not definite that the sequence of approximations 𝑥1 , 𝑥2 , … 𝑥𝑛 `always converges to the same
number which is the root of 𝑓(𝑥) = 0.
As such, we have to choose the initial approximations 𝑥0 suitably so that the successive
approximations 𝑥1, 𝑥2, … 𝑥𝑛 converge to the root 𝛼.
Example …

Exercises
(1) Starting with 𝑥 = 0.12, solve 𝑥 = 0.21 sin (0.5 + 𝑥) by using the iteration method.
(2) Find the real root of the equation 𝑓 (𝑥) = 𝑥 3 + 𝑥 2 − 1 = 0 by using iteration method.

Method of false position or Regular-false method


The bisection method guarantees that the iteration process will converge. It is however, show
these attempts have been made to speed up, the bisection method retaining its guaranteed
convergences. A method of doing it is called, the method of false position.
It is sometimes known as the method of linear interpolation. This is the oldest method for
finding the real roots of the numerical equation and closely resembles the bisection method.
In this method, we choose two points 𝑥0 and 𝑥1 such that 𝑓(𝑥0 ) and 𝑓(𝑥1 ) are of opposites
signs, since the graph of 𝑦 = 𝑓(𝑥) crosses the X-axis between these two points, a root must lie
between these points.
Consequently, 𝑓(𝑥0 ) −, 𝑓(𝑥1) < 0

The equation of the chord joining points {𝑥0 , 𝑓(𝑥0 )} and {𝑥1 , 𝑓(𝑥1 )} is
𝑓 (𝑥1 ) − 𝑓 (𝑥0 )
𝑦 − 𝑓 (𝑥0 ) = (𝑥 − 𝑥0 ) . . . (1)
𝑥1 − 𝑥0
The method consists in replacing the curve AB by means of the chord AB and taking the point of
intersection of the chord with the X-axis as an approximation to the root.
So the abscissa of the point where the chord cuts 𝑦 = 0 is given by
(𝑥1 − 𝑥0 )
𝑥2 = 𝑥0 − { } 𝑓(𝑥0 ) . . . (2)
𝑓(𝑥1 ) − 𝑓(𝑥0 )
Which is an approximation of the root.
----------
----------
Also lies between 𝑥1 and 𝑥2 and then we find 𝑥3 accordingly.
This procedure is repeated until the root is found to the desired accuracy.

EXAMPLE …

EXERCISES
1. Solve the following:
i. Solve 𝑥 3 − 5𝑥 + 3 = 0 by using Regular-Falsi method.
3
ii. Use the method of False position to solve 𝑥 3 − 𝑥 − 4 = 0.
2. Find a real root of the equation 3𝑥 + sin 𝑥 − 𝑒 𝑥 = 0 by method of False position. Correct to
four decimal places. Take 𝑥0 = 2, and 𝑥1 = 3.
3. Find the root of the equation 𝑥𝑒 𝑥 = cos 𝑥 in the interval (0 ,1) using Regular-Falsi method.
Correct to four decimal places.

Secant Method
This method is quite similar to that of the Regular-false method except for the condition
𝑓 (𝑥1 ). (𝑓𝑥2 ) < 0. Here the graph of the function 𝑦 = 𝑓(𝑥) in the neighborhood of the root is
approximated by the secant line or chords. Further, the interval at each iteration may not contain the
root. Let the limits of interval initially be 𝑥0 and 𝑥1.
Then the first approximation is given by:

𝑥1 −𝑥0
𝑥2 = 𝑥1 − [ ] 𝑓(𝑥1 )
𝑓(𝑥1 )−𝑓(𝑥0 )
Again, the formula for the successive approximations in general form is

𝑥𝑛 −𝑥𝑛−1
𝑥𝑛+1 = 𝑥𝑛 −) [ ] 𝑓(𝑥𝑛 )
𝑓(𝑥𝑛 )−𝑓(𝑥𝑛−1

If at any stage 𝑓 (𝑥𝑛 ) = 𝑓(𝑥𝑛−1 ), this method will fail. Hence, this method does not always converge
while Regular-false method will always converge. The only advantage in this method lies in the fact
that if it converges, it will converge more rapidly than the Regular-false method.

Example
Newton-Raphson Method
This method is generally used to improve the result obtained by one of the previous methods. Let 𝑥0
be an approximate root of 𝑓(𝑥) = 0 and let 𝑥1 = 𝑥0 + ℎ let be the better approximate root so
that𝑓 (𝑥1 ) = 0.
Expanding 𝑓(𝑥0 + ℎ) by Taylor Series, we get
′( )
ℎ2 ′′
𝑓 𝑥0 + ℎ𝑓 𝑥0 + 𝑓 (𝑥0 ) + ⋯ = 0
( )
2

𝑓 (𝑥1 ) − 𝑓 (𝑥0 )
𝑓 ′ (𝑥0 ) =
𝑥1 − 𝑥0
Since, 𝑓 (𝑥1 ) = 0
𝑓 ′ (𝑥0 )(𝑥1 − 𝑥0 ) = −𝑓(𝑥0 )
𝑓 (𝑥0 )
𝑥1 − 𝑥0 = − ′
𝑓 (𝑥0 )
𝑓 (𝑥0 )
𝑥1 = 𝑥0 − ′
𝑓 (𝑥0 )
[First approximate root]
Second approximate root

4
𝑓 (𝑥1 )
𝑥2 = 𝑥1 −
𝑓 ′ (𝑥1 )
𝑓 (𝑥2 )
𝑥3 = 𝑥2 − ′
𝑓 (𝑥2 )
𝑓 (𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 − ′
𝑓 (𝑥𝑛 )
Where n= 0, 1, 2, …
By repeating this operation, we get closer approximation of the root.
NOTE
1. In the beginning, we guess two numbers b and c such that 𝑓(𝑏) and 𝑓(𝑐) are of opposite sign.
Then the first approximate a root lies between b and c.
2. If 𝑓′(𝑥) is zero or nearly zero, this method fails.
3. This method is useful in case of large values of 𝑓′(𝑥), i.e, when the graph of 𝑓(𝑥) while
crossing the X-axis is nearly vertical.

EXAMPLE ….

EXERCISES
1. Evaluate √12 to four decimal places by Newton’s iterative method; with initial guess of 𝑥0 =
3.5.
2. Obtain Newton-Raphson’s extended formula
𝑓 (𝑥0 ) 1 𝑓(𝑥0 )2 × 𝑓 ′′ (𝑥0 )
𝑥1 = 𝑥0 − ′ − { }
𝑓 (𝑥0 ) 2 {𝑓 ′ (𝑥0 )}3
For the root of the equation 𝑓 (𝑥) = 0.
3. Find a real root of the equation 𝑥 = 𝑒 −𝑥 , using the Newton-Raphson method.
4. Write the Newton-Raphson procedure for finding 3√𝑁, where N is a real number, use it to find
3√12. Correct to 2 decimal places, assuming 2.5 as the initial guess.
5. Use Newton-Raphson method to find the real root where 2ofthe equation 𝑥 4 − 11𝑥 + 8 = 0,
accurate to five decimal places.

You might also like