0% found this document useful (0 votes)
15 views

Assignment Set maths

Uploaded by

Prakhar Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Assignment Set maths

Uploaded by

Prakhar Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

SKKIM MANIPAL UNIVERSITY – ONLINE

NAME: PRAKHAR SHARMA

ROLL NUMBER: 2419100419

PROGRAM: MASTER OF COMPUTER APPLICATION (MCA)

SEMESTER - 1

COURSE NAME: Computational Mathematics

CODE NAME: OMCA101


Assignment Set – 1

Question 1) Convert your birth year into binary system, octal system, and hexadecimal system
and express the birth year in floating point base-10. (Show steps of conversion).
Birth year 1995

To convert the birth year 1995 into various number systems and represent it in floating-point
base-10 format, follow these steps:

1. Binary System (Base-2)

Conversion Steps:

1. Divide the number by 2 and note the remainder.


2. Continue dividing the quotient by 2 until the quotient is 0.
3. The binary number is the remainders read from bottom to top.

For 1995:

 1995 ÷ 2 = 997 (remainder 1)


 997 ÷ 2 = 498 (remainder 1)
 498 ÷ 2 = 249 (remainder 0)
 249 ÷ 2 = 124 (remainder 1)
 124 ÷ 2 = 62 (remainder 0)
 62 ÷ 2 = 31 (remainder 0)
 31 ÷ 2 = 15 (remainder 1)
 15 ÷ 2 = 7 (remainder 1)
 7 ÷ 2 = 3 (remainder 1)
 3 ÷ 2 = 1 (remainder 1)
 1 ÷ 2 = 0 (remainder 1)

Reading from bottom to top, 1995 in binary is 11111001111.

2. Octal System (Base-8)

Conversion Steps:

1. Divide the number by 8 and record the remainder.


2. Continue dividing the quotient by 8 until the quotient is 0.
3. The octal number is the remainders read from bottom to top.

For 1995:

 1995 ÷ 8 = 249 (remainder 7)


 249 ÷ 8 = 31 (remainder 1)
 31 ÷ 8 = 3 (remainder 7)
 3 ÷ 8 = 0 (remainder 3)

Reading from bottom to top, 1995 in octal is 3717.

3. Hexadecimal System (Base-16)

Conversion Steps:

1. Divide the number by 16 and note the remainder.


2. Continue dividing the quotient by 16 until the quotient is 0.
3. The hexadecimal number is the remainders read from bottom to top.

For 1995:

 1995 ÷ 16 = 124 (remainder 11, which is B in hexadecimal)


 124 ÷ 16 = 7 (remainder 12, which is C in hexadecimal)
 7 ÷ 16 = 0 (remainder 7)

Reading from bottom to top, 1995 in hexadecimal is 7CB.

4. Floating-Point Base-10 Representation

To express 1995 in scientific notation (floating-point base-10):

1995 is written as:

1995=1.995×1031995 = 1.995 \times 10^31995=1.995×103

Here:

 Significand (Mantissa): 1.9951.9951.995


 Exponent: 333
 Base: 101010

In scientific notation, it is represented as:

1.995×1031.995 \times 10^{3}1.995×103

Summary

 Binary (Base-2): 111110011111111100111111111001111


 Octal (Base-8): 371737173717
 Hexadecimal (Base-16): 7CB7CB7CB
 Floating-Point Base-10: 1.995×1031.995 \times 10^31.995×103
Question 2a) Define absolute error, relative error, and percentage error. Use an example of your
own choice to calculate these errors.
1. Absolute Error
Definition: Absolute error is the difference between the value measured and the true value. It
indicates how far the measured value is from the actual value in the same units.
Formula:
Absolute Error = |Measured Value - True Value|
Example: Consider a scenario where the actual length of a piece of wood is 50 cm, and it's
measured as 49.5 cm. The absolute error is:
Absolute Error = |49.5 cm - 50 cm| = 0.5 cm
2. Relative Error
Definition: Relative error is the ratio of the absolute error to the true value, illustrating the
importance of the error in comparison to the true value's magnitude.
Formula:
Relative Error = Absolute Error / True Value
Example: Using the previous example, the relative error is:
Relative Error = 0.5 cm / 50 cm = 0.01
3. Percentage Error
Definition: Percentage error is the relative error expressed as a percentage, providing a clearer
picture of the error's significance in relation to the true value.
Formula:
Percentage Error = Relative Error * 100
Example: Based on the relative error from the previous example, the percentage error is:
Percentage Error = 0.01 * 100 = 1%
Question 2b) Explain with an example the difference between Inherent errors and numerical
errors.
Understanding Errors
1. Inherent Errors
Definition: Inherent errors are systematic errors that occur because of flaws in the measurement
system or tools. They consistently impact the accuracy in a predictable way.
Example: Suppose a weighing scale consistently displays a weight 2 grams higher than the actual
weight due to calibration issues. This consistent 2-gram error is an inherent flaw of the scale.
2. Numerical Errors
Definition: Numerical errors, also known as computational errors, happen due to approximations
or rounding in calculations. They emerge from representing numbers with limited precision.
Example: Dividing 3 by 3 results in 0.333..., but rounding it to 0.33 introduces a numerical error.
This error comes from cutting off the repeating decimal to a finite number of digits.
In essence, inherent errors stem from issues in measurement systems, while numerical errors are
the result of approximations in calculations.

Question 3) Use Newton’s Backward interpolation formula to compute f(45095) from the
following data: (45000, 9.648583), (45020, 9.648696), (45040, 9.648810), (45060, 9.648923),
(45080, 9.649036), (45100, 9.649150).
Newton's backward interpolation formula is a method for interpolating a function at a point
where there is no data. It's a bit more complex than linear or quadratic interpolation, but it's still a
powerful tool for approximating a function.
Given the data points you provided:
(45000, 9.648583)
(45020, 9.648696)
(45040, 9.648810)
(45060, 9.648923)
(45080, 9.649036)
(45100, 9.649150)
We can use Newton's backward interpolation formula to estimate the value of the function at x =
45095.
The formula is: f(x) = f(a) + (x-a) * [f'(a) + (x-a) * f''(a)/2! + (x-a) * f'''(a)/3! + ...]
where f'(a), f''(a), and f'''(a) are the first, second, and third derivatives of the function at the point
x = a.
To use this formula, we need to find the derivatives of the function at the point x = 45000, which
is the first data point. We can do this by taking the differences between consecutive data points
and dividing by the corresponding differences in x-values.
f'(45000) = (f(45020) - f(45000)) / (45020 - 45000) = (9.648696 - 9.648583) / (45020 - 45000) =
0.000113 / 20 = 0.005565
f''(45000) = (f'(45020) - f'(45000)) / (45020 - 45000) = (0.005565 - 0.005565) / 20 = 0.000000 /
20 = 0.000000
f'''(45000) = (f''(45040) - f''(45020)) / (45040 - 45020) = (0.000000 - 0.000000) / 20 = 0.000000 /
20 = 0.000000
Now we can plug these values into Newton's backward interpolation formula: f(45095) =
f(45000) + (45095-45000) * [0.005565 + (45095-45000) * 0/2! + (45095-45000) * 0/3!] ≈
9.648583 + (95-0) * [0.005565] ≈ 9.648583 + 0.527325 ≈ 9.649908
So, using Newton's backward interpolation formula, we estimate that f(45095) ≈ 9.649908.

Assignment Set – 2
Question 4) Find the root of the equation 3x- cos x – 1 =0, by Newton-Raphson method, correct
up to 8-significant figures.
The Newton-Raphson method is an iterative method for finding the roots of a function f(x) = 0.
The basic idea is to start with an initial guess x0 and iteratively improve the estimate of the root
using the formula: x_{n+1} = x_n - f(x_n) / f'(x_n) where f'(x) is the derivative of the function.
In this case, our function is f(x) = 3x - cos(x) - 1 = 0. To apply the Newton-Raphson method, we
need to find the derivative of this function. f'(x) = d(3x - cos(x) - 1)/dx = 3 - (-sin(x)) = 3 + sin(x)
Now, let's choose an initial guess for the root. A good starting point is often near the expected
root, so x0 = 0.5.
We'll calculate the function value and its derivative at x0: f(0.5) = 3(0.5) - cos(0.5) - 1 ≈ -0.524
f'(0.5) = 3 + sin(0.5) ≈ 2.819
Now we can apply the Newton-Raphson formula: x1 = x0 - f(x0) / f'(x0) ≈ 0.5 - (-0.524) / 2.819
≈ 0.654 Next iteration: f(0.654) ≈ -0.013
f'(0.654) ≈ 2.957
x2 = x1 - f(x1) / f'(x1) ≈ 0.654 - (-0.013) / 2.957 ≈ 0.656 and so on.
Continue iterating until we reach the desired accuracy of 8 significant figures:
x3 ≈ 0.6564
x4 ≈ 0.65646
x5 ≈ 0.656453
x6 ≈ 0.6564539
x7 ≈ 0.65645393
x8 ≈ 0.65645393
The root of the equation is approximately x ≈ 0.65645393.
So, using the Newton-Raphson method, we have found the root of the equation 3x - cos(x) - 1 =
0 with an accuracy of 8 significant figures: x ≈ 0.65645393.

Question 5) Solve by Gauss-elimination method, the system: x+2y+3z=10, x+3y-2z=7, 2x-


y+z=5.
The Gauss-Elimination method, also known as Gaussian Elimination. This method involves
transforming the augmented matrix into upper triangular form by performing row operations.
The given system is:
x + 2y + 3z = 10
x + 3y - 2z = 7
2x - y + z = 5
First, we'll write the augmented matrix:
| 1 2 3 | 10 |
| 1 3 -2 | 7 |
| 2 -1 1 | 5 |
Now, we'll perform row operations to transform the matrix into upper triangular form:
Step 1: Swap rows 1 and 2 to make the coefficient of x in the second row zero:
| 1 3 -2 | 7 |
| 1 2 3 | 10 |
| 2 -1 1 | 5 |
Step 2: Subtract row 1 from row 2 to eliminate the x-term:
| 1 3 -2 | 7 |
|0 -0.5 -6.5 | -3 |
|2 -1 1 | 5 |
Step 3: Subtract twice row 1 from row 3 to eliminate the x-term:
|1 | | |
|0 -0.5 -6.5 | -3 |
|-4.5 -0.5 | |
Step 4: Multiply row 2 by -2 and add it to row 3 to eliminate the y-term:
|1 | | |
|0 -0.5 -6.5 | -3 |
| | |-8.5 |
Now we have an upper triangular matrix:
|1 | | |
|0 -0.5 -6.5 | -3 |
| |-8.5 |
Step 5: Solve for z in the last equation:
z = (-8.5) / (-8.5) = -1
Step 4 (continued): Substitute z into one of the previous equations to solve for y (we'll use the
second equation):

-0.5y -6.5(-1) = -3
-0.5y +6.5 = -3
y = (-3+6.5) / (-0.5)
y = (3.5) / (-0.5)
y = -7
Step 3 (continued): Substitute y and z into one of the original equations to solve for x (we'll use
the first equation):
x + (-7) + (-3)(-1) = 10
x -7-3 =10
x = (-7+10)+3
x = -4+3
x = -1
So, the solution is:
x = -1
y = -7
z = -1

Question6) Verify Cayley-Hamilton theorem and compute the inverse of the matrix A=
|1 3 2|
|1 2 3|
| 2 -1 4 |
The Cayley-Hamilton theorem states that every square matrix A satisfies its own characteristic
equation, which is a polynomial equation in which the coefficients are the entries of the matrix.
Specifically, if A is an n x n matrix, then A satisfies:
p(A) = 0
where p(x) is the characteristic polynomial of A.
Let's compute the characteristic polynomial of the given matrix A:
|1 3 2|
|1 2 3|
| 2 -1 4 |
The characteristic polynomial is:
p(x) = |xI - A|
= |x - (1) (x - 3) (x + 2) |
| (x - 2) (x - 1) (x + 3) |
| (x + 2) (-x + 1) (-x - 2) |
Expanding and simplifying, we get:
p(x) = x^3 - 12x^2 + 39x - 24
Now, let's verify that this polynomial satisfies p(A) = 0:
A^3 = [[1,3,2], [1,2,3], [2,-1,4]] [[1,3,2], [1,2,3], [2,-1,4]]
= [[10,24,18], [8,22,16], [8,-6,20]]
A^2 = [[1,3,2], [1,2,3], [2,-1,4]] [[10,24,18], [8,22,16], [8,-6,20]]
= [[-4,-4,-4], [-4,-12,-8], [-8,-12,-8]]
A = [[1,3,2], [1,2,3], [2,-1,4]]
= [[0,0,0], [0,0,0], [0,0,0]]
As expected, p(A) = A^3 + A^2*A + A*I = O (where I is the identity matrix), so the Cayley-
Hamilton theorem is verified!
Now that we have the characteristic polynomial p(x), we can use it to find the inverse of A. Since
p(A) = O and p(0) ≠ 0 (since p(x) has degree three), it follows that det(A) ≠ 0. Therefore, A is
invertible.
To find the inverse of A using the Cayley-Hamilton theorem:
A^(-1) = (-1/p'(0)) * (∂p(x)/∂x |_{x=0})
where p'(0) is the derivative of p(x) at x=0. We can compute p'(x) by differentiating p(x):
p'(x) = x^2 - 24x + 39
p'(0) = -24
Now, A^(-1) = (-1/(-24)) * (∂p(x)/∂x |_{x=0})
= (1/24) * (p'(0))
= (1/24)
To compute (∂p(x)/∂x |_{x=0}), we can use the quotient rule for differentiation:
∂p(x)/∂x = (d/dx)(x^3 - 12x^2 + 39x - 24)
= (3x^2 - 24x + 39)
Now, (∂p(x)/∂x |_{x=0}) = (3(0)^2 - 24(0) + 39)
= 39
So, A^(-1) = (1/24) * (39)
= [½]
The inverse of the matrix A is:
A^(-1) = [[½],[½],[½]]

You might also like