bca sem 3 computer oriented numerical methods bc0043

12
BCA 3 rd Semester BC0043 – 01 Computer Oriented Numerical Methods Q1. Find a real root of the equation x3 – 2x – 5 = 0 by the method of regula-falsi position, correct to three decimal places. Let f (x) = x 3 – 2x – 5 Then f (1) = 1 – 2 – 5 = – 6 < 0 f (2) = 8 – 4 – 5 = – 1 < 0 f (3) = 27 – 6 – 5 = 16 > 0 Hence a root lies between 2 and 3. Take x 1 = 2, x 2 = 3, f (x 1 ) = – 1, f (x 2 ) = 16, in the method of false position, we get x 3 = x 1 = 2 – = = 2 + = 2.0588 Now f(x 3 ) = f(2.0588) = (2.0588) 3 – 2 ´ 2.0588 – 5 = – 0.3908 < 0. Since f(2.0588) < 0 we have that root lies between 2.0588 and 3.0. 1

Upload: sreejithe-thummarukudy

Post on 12-Nov-2014

112 views

Category:

Documents


3 download

DESCRIPTION

BCA SEM 3 Computer Oriented Numerical Methods BC0043

TRANSCRIPT

BCA 3rd SemesterBC0043 – 01

Computer Oriented Numerical Methods

Q1. Find a real root of the equation x3 – 2x – 5 = 0 by the method of regula-falsi position, correct to three decimal places.

Let f (x) = x3 – 2x – 5

Then f (1) = 1 – 2 – 5 = – 6 < 0

f (2) = 8 – 4 – 5 = – 1 < 0

f (3) = 27 – 6 – 5 = 16 > 0

Hence a root lies between 2 and 3.

Take x1 = 2, x2 = 3, f (x1) = – 1, f (x2) = 16, in the method of false position, we get

x3 = x1 – = 2 – = = 2 + = 2.0588

Now f(x3) = f(2.0588) = (2.0588)3 – 2 ´ 2.0588 – 5 = – 0.3908 < 0.

Since f(2.0588) < 0 we have that root lies between 2.0588 and 3.0.

Replace x1 by x3, and generate the next approximation using the formula,

x4 = x3 – = 2.0588 – = 2.0813.

Repeating this process, the successive approximations are x5 = 2.0862,x6 = 2.0915, x7 = 2.0934, x8 = 2.0941, x9 = 2.0943 etc.

1

Hence the root x = 2.094 correct to three decimal places.

Observation: The regula-falsi method is intended to produce faster convergence to the solution. However, it does not always do so. Sometimes, the values of xnew do not improve quickly. One reason for the slow convergence can be the departure from the basic premises on which the false position method is built.

Q2. Find a real root of the transcendental equation cosx – 3x + 1 = 0, correct to four decimal places using the method of iteration.

Let f(x) = cos x – 3x + 1.

Now f(0) = cos 0 – 0 + 1 = 2 > 0 and f + 1 < 0. Therefore a root lies

between 0 and .

Rewriting the given equation cos x – 3x + 1 = 0 as

x = (1 + cos x) = (x) – (i)

(x) = (1 + cos x) (say)

Differentiate with respect to x on both the sides,

(x) = and

Since

1, we have < 1.

2

Therefore | (x) | < 1 for all x in .

Hence the iteration method can be applied to the equation (i) and we start with x0 = 0 or any

choice of x in the interval

x1 = (x0) = (1+ cos 0) = 0.6667

x2 = (x1) = (1+ cos 0.6667) = 0.5953

x3 = (x2) = (1+ cos 0.5953) = 0.6093

x4 = (x3) = (1+ cos 0.6093) = 0.6067

x5 = (x4) = (1+ cos 0.6067) = 0.6072

x6 = (x5) = (1+ cos 0.6072) = 0.6071

x7 = (x6) = (1+ cos 0.6071) = 0.6071

Hence we take the solution as x = 0.6071 correct to 4 decimal place.

3

Q3. Find the rank of using elementary row transformation.

The rank of A ≤ min {3, 4} = 3.

A = [Firstly we use the leading entry in the first row 1 to make the leading entries in second and third rows to zero].

Perform,

Perform,

Perform,

The above matrix is in the echelon form having two non-zero rows. Hence the rank of A is 2.

4

Q4. Apply Gauss-Seidel iteration method to solve the equations

Solution:

We write the equation in the form ( after partial pivoting),

And …………………(i)

………………(ii)

………………(iii)

Initial approximation:

First Iteration:

Second Iteration

5

The values in the 2nd and 3rd iterations being practically the same, we can stop the iterations. Hence the solution is

Q5. Use the method of group averages and find a curve of the form y = mxn, that fits the following data:

X 10 20 30 40 50 60 70 80 Y 1.06 1.33 1.52 1.68 1.81 1.91 2.01 2.11

Solution: The required curve is of the form y = mxn

Taking logarithm on both sides, we get

log10y = log10 m+ n log10x

Let log10y = Y, log10m = c and log10x = X, then the equation becomesY = nX +c.

Now e take logarithms of the given pairs of data and divide them into two groups, such that the first group contains the first four values and the remaining constitutes the second group, as follows.

6

Group-I

x y Y = log10 y X = log10x10 1.06 0.0253 1.0000 20 1.33 0.1239 1.3010 30 1.52 0.1818 1.4771 40 1.68 0.2253 1.6021

SY = 0.5563 SX = 5.3802

Group-II

x y Y = log10 y X = log10x50 1.81 0.2577 1.6990 60 1.91 0.2810 1.7782 70 2.01 0.3032 1.8451 80 2.11 0.3243 1.9031

SY = 1.1662 SX = 7.2254

Using the method of group averages, we determine the constants n and c from (5) and (6) as follows.

Substituting the values from the above tables, we get

and

Þ 4c + 5.3802n – 0.5563 = 0 and

4c + 7.2254n- 1.1662 = 0.

Solving we get c = -0.3055 and n = 0.3305.

Therefore m = antilog c = 0.4949.

Hence the required curve is y = (0.4949)x0.3305.

7

Q6. Given that

x 1.0 1.1 1.2 1.3 1.4 1.5 1.6y 7.989 8.403 8.781 9.129 9.451 9.750 10.031

Find and at (a) x = 1.1 (b) x = 1.6 using Newton’s forward difference formulae.

The difference table is,

x y D D2 D3 D4 D5 D6

1.0

1.1

1.2

1.3

1.4

1.5

1.6

7.989

8.8403

8.781

9.129

9.451

9.750

10.031

0.414

0.378

0.348

0.322

0.299

0.281

-0.036

-0.030

-0.026

-0.023

-0.018

0.006

0.004

0.003

0.005

-0.002

-.0001

0.002

0.0010.003

0.002

To find and at x = 1.1, we use Newton's Forward differentiation formula, we have

Here h = 0.1, x0 = 1.0, x1 = 1.1. The above formula can be rewritten as

(i)

8

(ii)

Substituting Dy1 = 0.378, D2y1 = – 0.030, D3y1 = 0.004, D4y1 = – 0.001, D5y1 = 0.003 in (i) and (ii), we get

= 3.947

Therefore

Therefore

To find at x = 1.6, we have to use Newton's backward differentiation formula, that is,

… (iii)

and

… (iv)

We use the above difference table and backward difference operator Ñinstead of D.

Here h = 0.1, xn = x6 = 1.6 and Ñy6 = 0.281, Ñ2y6 = – 0.018, Ñ3y6 = 0.005, Ñ4y6 = – 0.002, Ñ5y6 = 0.003, Ñ6y6 = 0.002.

Putting these values in (iii) and (iv), by taking n = 6, we get,

9

Therefore

and

.

10