bc0043

7
November 2012 Bachelor of Computer Application (BCA) – Semester 3 BC0043 – Computer oriented numericalmethods – 4 Credits (Book ID: B0804) Total Marks: 60 Marks 1. Explain the following terms in five sentences each Ans: (i)Data error : - (also known as empirical error) arises when data for a problem are obtained by some experimental means and are, therefore, of limited accuracy and precision. This may be due to some limitations ml instrumentation and reading, and therefore may be unavoidable. A physical measurement, such as a distance, a voltage, or a time period cannot be exact. To remember that there is use in performing arithmetic operations to, say, four decimal when the original data themselves are only correct to two decimal places. For instance, the scale reading in a weighing machine may be accurate to only one decimal place. (ii) Conversion error : - (also known as representation errors) arise due to the limitations of the computer to store the data exactly. We know that the floating point representation retains only a specified number of digits. The digits that are not retained constitute the round off error. (iii) Numerical error :- Numerical errors are introduced during the process of implementation of a numerical method. They come in two forms, round off errors and truncation errors. The total numerical error is the summation of these two errors. The total error can be reduced by devising suitable techniques for implementing the solution. We shall see in this section the magnitude of these errors.

Upload: chandan-kumar

Post on 01-Nov-2014

118 views

Category:

Documents


6 download

DESCRIPTION

BC0043 2013 ASSIGNEMENT

TRANSCRIPT

Page 1: BC0043

November 2012Bachelor of Computer Application (BCA) – Semester 3

BC0043 – Computer oriented numericalmethods – 4 Credits(Book ID: B0804)

Total Marks: 60 Marks

1. Explain the following terms in five sentences eachAns: (i)Data error : -  

(also known as empirical error) arises when data for a problem are obtained by some experimental means and are, therefore, of limited accuracy and precision. This may be due to some limitations ml instrumentation and reading, and therefore may be unavoidable. A physical measurement, such as a distance, a voltage, or a time period cannot be exact. To remember that there is use in performing arithmetic operations to, say, four decimal when the original data themselves are only correct to two decimal places.

    For instance, the scale reading in a weighing machine may be accurate to only one decimal place.

(ii) Conversion error : - (also known as representation errors) arise due to the limitations of the

computer to store the data exactly. We know that the floating point representation retains only a specified number of digits. The digits that are not retained constitute the round off error.

(iii) Numerical error :-Numerical errors are introduced during the process of implementation of a

numerical method. They come in two forms, round off errors andtruncation errors. The total numerical error is the summation of these two errors. The total error can be reduced by devising suitable techniques for implementing the solution. We shall see in this section the magnitude of these errors.

(iv) Round off error: -Every computer has a finite word length and therefore it is possible to store

only a fixed number of digits of a given input number. Since computers store information in binary form, storing an exact decimal number in its binary form into the computer memory gives an error. This error is computer dependent. Also, at the end of computation of a particular problem, the final results in the computer, which is obviously in binary form, should be converted into decimal form – a form understandable to the user – before their print out. Therefore, an additional error is committed at this stage too. This error is called local round-off error.

Page 2: BC0043

It is clear that (0.7625)10 = (0.11000011 (00l1))2. If a particular computer system has a word length of 12 bits only, then the decimal number0.7625 is stored in the computer memory in binary form as 0.110000110011. However, it is equivalent to 0.76245. Thus, in storing the number 0.7625, we have committed an error equal to 0.00005, which is the round-off error; inherent with the computer system considered.

(v) Truncation error : - Truncation errors arise from using an approximation in place of an exact mathematical procedure.

Typically, it is the error resulting from the truncation of the numerical process. We often use some finite number of terms to estimate the sum of an infinite series. For example,

S =∑i=0

ai xi is replaced by the finite sum 

Consider the following infinite series:

sin x = x – x33 !

 + x55 !

– ….

When we calculate the sine of an angle using this series, we cannot use all the terms in the series for computation. We usually terminate the process after a certain term is calculated. The terms "truncated" introduce an error which is called truncation error.

Many of the iterative procedures used in numerical computing are infinite and, therefore, a knowledge of this error is important. Truncation error can be reduced by using a better numerical model which usually increases the number of arithmetic operations.

In numerical integration, the truncation error can be reduced by increasing the number of points at which the function is integrated. But care should be exercised to see that the roundoff error which is bound to increase due to increase in arithmetic operations does not off-set the reduction in truncation error.

(vi) Significant digits: -The digits that are used to express a number are called significant digits or significant figures. The significant figures of a number are defined as follows:

Rule 1: (Numbers without decimal point): If the number does not have any decimal point, the significant figures of the number are the digits counted from the first non-zero digit on the left to the last non-zero digit on the right. Therefore, the number 12040 has four significant figures.

Rule 2: (Numbers with decimal point): If the number has a decimal point, the significant figures of the number are the digits counted from the first non-zero digit on the left to the last digit on the right side (irrespective of whether it is zero or non-zero). Therefore, the number,2100.4, has five significant figures, and the number 0.015, has two significant figures.

Thus each of the numbers 3.1416, 0.60125 and 4.0002 contain five significant digits while the numbers 0.00386, 0.000587 and 0.00205 contain only three significant digits, since zeros only help to fix the position of the decimal point.

2. Find the real root of the equation x3 – 4x – 9 = 0 using the Bisection method.

Solution: Let f(x) = x3 – 4x – 9

    f(1) = 1 – 4 – 9 = –12 < 0   

    f(2) = 8 – 8 – 9 = – 9 < 0

    f(3) = 27 – 12 – 9 = + 6 > 0

Since f(2) is negative and f(3) is positive, a root lies between 2 and 3.

Page 3: BC0043

Therefore the first approximation to the root is x1 = 2+32

 = 2.5

Then f(x1) = f (2.5) = 2.53 – 4  2.5 – 9 = – 3.375 < 0.Hence the root lies between 2.5 and 3. Since f(2.5) < 0 and f(3) > 0, we have the second approximation to the root is

    x2  = x1+32

  =2.5+32

= 2.75

Then f(x2) = f(2.75) = (2.75)3 – 4  2.75 – 9 = 0.7969 > 0.Therefore conclude that the root lies between 2.5 and 2.75 and so the third approximation to the root is

    x3 =2.5+2.75

2 = 2.625

Also f (x3) = f (2.625) = –1.4121 < 0. Now since f (x3) < 0 and f(x2) > 0, we have that root lies between x2 and x3. Thus the fourth approximation to the root is

    x4 = 2.75+2.625

2 = 2.6875

The procedure is repeated and the successive approximations are x5 = 2.703125, x6 = 2.7109375,

x7 = 2.70703125, x8 = 2.7051 etc. Therefore x = x8 = 2.7051 is the approximate root.

3. Find a real root of the equation x3 – 2x – 5 = 0 by the method of Regula-falsi position,

correct to three decimal places.

Solution: 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 –f ( x1 )(x 2−x 1)f ( x 2 )−f (x1)

= 2 – (−1 )(3−2)16−(−1)

=  = 2 +117

 = 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 –f ( x3 )(x2−x 3)f ( x 2 )−f (x3)

= 2.0588 –(−0.3908 )(3−2.0588)16−(−0.3908)

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

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.

4. Find a real root of the transcendental equation cos x – 3x + 1 = 0, correct to four

Page 4: BC0043

decimal places using the method of iteration.

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

Now f(0) = cos 0 – 0 + 1 = 2 > 0 and f( π2) = cos

π2+3π2 +1= -

3π2 +1 < 0. Therefore a

root lies between 0 and π2

.

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

x =13

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

  (x) = 13

 (1 + cos x) (say)

Differentiate with respect to x on both the sides,

    (x) = −sinx3

 and

Since|sinx|  1, we have |∅' ( x )∨¿=| 

−sin x3 |≤

13 <1.

Therefore | (x) | < 1 for all x in (0,π2 ). .

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 (0,π2 )]

x1 =  (x0) = 13 (1+ cos x0) =

13

(1+ cos 0) = 0.6667

x2 =  (x1) = 13

  (1+ cos x0) = 13

(1+ cos 0.6667) = 0.5953

x3 =  (x2)    = 13

  (1+ cos x0) = 13

(1+ cos 0.5953) = 0.6093

x4 =  (x3) = 13

  (1+ cos x0) = 13

(1+ cos 0.6093) = 0.6067

x5 =  (x4) = 13

  (1+ cos x0) = 13

(1+ cos 0.6067) = 0.6072

x6 =  (x5) = 13

  (1+ cos x0) = 13

(1+ cos 0.6072) = 0.6071

x7 =  (x6) = 13

  (1+ cos x0) = 13

(1+ cos 0.6071) = 0.6071

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

5. Compute the adjoint as well as the inverse of the matrix A =[1 2 31 3 41 4 3 ].

Page 5: BC0043

Solution:The adjoint of a square matrix is the transpose of the matrix obtained by replacing each element of A by its co-factor in A.

Adj A =[−7 1 16 0 −2

−1 −1 1 ]  =[−7 6 −11 0 −11 −2 1 ] and

det A =|A| =|1 2 31 3 41 4 3|   =  = –7 + 2 + 3 = –2. Therefore,

A-1 is, A–1 =Adj A|A|   = |−7 6 −1

1 0 −11 −2 1 |

−2

= [−72

612

12

012

−12

−2−12

].Observations:   

 i)    Inverse of a matrix is unique.     ii)    (AB)–1 = B–1 A–1

     iii)    AA–1 = A–1A = I .

6. Find the rank of the matrix [1212 3 23 5 13 4 5 ] using elementary row transformation.

Solution:

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

A = [1212 3 23 5 13 4 5 ]

R1R2R3

[Firstly we use the leading entry in the first row 1 to make the leading entries in second

and third rows to zero].

Perform,R2 → R2 – -2R1, then A ≈ [1202 3 2

−1 −1 −31 1 3 ]

R3 → R3 – R1

Perform, R2 → (-1)R2 then A ≈ [1002 3 21 1 31 1 3]

T

Page 6: BC0043

Perform, R3 → R3 – R2, then A ≈ [1002 3 21 1 30 0 0 ]

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