Sei sulla pagina 1di 5

CSE330: Numerical Methods

Quiz 1 Solution

 Following Bisection method fill up the table in order to solve the equation given
below. Assume Xl = 0.5, and Xu = 1.5

f(x) = 2 − 5e–x

f(Xl) f(Xu) f(Xl) ∗ f(Xu)


-1.03265 0.884349 -0.516326649 <0

As f(Xl) ∗ f(Xu) < 0, there is a root between Xl and Xu.

Iteration Xl Xu Xm f(Xl) f(Xm) f(Xl) ∗ f(Xm) sign %Error

1 0.5 1.5 1 -1.03265 0.160603 -0.165847 - ve -

2 0.5 1 0.75 -1.03265 -0.36183 0.3736478 + ve 33.33333%

3 0.75 1 0.875 -0.36183 -0.08431 0.03050616 + ve 14.28571%

 Following Bisection method fill up the table in order to solve the equation given
below. Assume Xl = 1.0 and Xu = 1.7

f(x) = 10e–X − 3

f(Xl) f(Xu) f(Xl) ∗ f(Xu)


0.678794 -1.17316 -0.796337683 <0

As f(Xl) ∗ f(Xu) < 0, there is a root between Xl and Xu.

Xl Xu Xm f(Xl) f(Xm) f(Xl) ∗ f(Xm)


Iteration sign %Error
1 1 1.7 1.35 0.678794 -0.4076 -0.2766748 - ve -
2 1 1.35 1.175 0.678794 0.08819 0.05986274 + ve 14.89362%
3 1.175 1.35 1.2625 0.08819 -0.17054 -0.0150401 - ve 6.930693%
 Following Bisection method fill up the table in order to solve the equation given
below. Assume Xl = - 1.6, and Xu = - 0.6

f(x) = X3 + 4X2 + X + 6

f(Xl) f(Xu) f(Xl) ∗ f(Xu)


10.544 6.624 69.843456 >0

As f(Xl) ∗ f(Xu) > 0, there is not root between Xl and Xu.


Quiz 2 Solution

 Following Newton-Raphson method fill up the table in order to solve the equation
given below. Assume X0 = 0. 75

f(x) = 6x3 − 2x2 + 0. 5x − 9

f ’(x) = 18x2 − 4x + 0. 5

Iteration
Xi f(Xi) f ’(Xi) Xi+1 % Error
Count

1 0.75 -7.21875 7.625 1.69672131 55.7971%

2 1.696721311 15.39840559 45.53265 1.35853751 24.89323%

3 1.358537508 3.03211833 28.28708 1.2513466 8.566045%

 Following Secant method fill up the table in order to solve the equation given below.
Assume X0 = -1.25 and X1 = -0.75

f(x) = 3x3 + 5x2 − 7x + 2. 5

Iteration
Xi–1 Xi f(Xi–1) f(Xi) Xi+1 % Error
Count

1 -1.25 -0.75 13.2031 9.29688 0.44 270.454545%

2 -0.75 0.44 9.29688 0.64355 0.528500901 16.745648%

3 0.44 0.528500901 0.64355 0.63991 16.08499036 96.7143226%


 Determine the value of the y at x = 1. 5 with second order polynomial interpolation
using Newton’s divided difference polynomial method.

X Y
-1 2.2
0 10.6
1 17.0
2 22.4
3 25.8

As polynomial order is 2, it is required to have 3 points

As two points represent the same distance (0 and 3), it is possible to choose any of
them.

Considering points as x0 = 0, x1 = 1 and x2 = 2

X Y b0 = 10. 6
0 10.6 6.4 -0.5 b1 = 6. 4
1 17 5.4 b2 = −0. 5
2 22.4

y(x) = b0 + b1 ∗ (x − x0) + b2 ∗ (x − x0) ∗ (x − x1)


y(1. 5) = 10. 6 + 6. 4 ∗ (1. 5 − 0) + (−0. 5) ∗ (1. 5 − 0) ∗ (1. 5 − 1)
y (1. 5) = 19. 825

Considering points as x0 = 1, x1 = 2 and x2 = 3

X Y b0 = 17
1 17 5.4 -1 b1 = 5. 4
2 22.4 3.4 b2 = −1
3 25.8

y(x) = b0 + b1 ∗ (x − x0) + b2 ∗ (x − x0) ∗ (x − x1)


y(1. 5) = 17 + 5. 4 ∗ (1. 5 − 1) + (−1) ∗ (1. 5 − 1) ∗ (1. 5 − 2)
y (1. 5) = 19. 95
 Determine the value of the y at x = 2. 5 with second order polynomial interpolation
using Newton’s divided difference polynomial method.

X Y
-2 3.2
-1 10.6
0 17.0
2 25.4
3 32.8

As polynomial order is 2, it is required to have 3 points

Considering points as x0 = 0, x1 = 1 and x2 = 2

X Y
b0 = 17
0 17 4.2 1.06667 b1 = 4. 2
2 25.4 7.4 b2 = 1. 0667
3 32.8

y(x) = b0 + b1 ∗ (x − x0) + b2 ∗ (x − x0) ∗ (x − x1)


y (2. 5) = 17 + 4. 2 ∗ (2. 5 − 0) + 1. 0667 ∗ (2. 5 − 0) ∗ (2. 5 − 2)
y (2. 5) = 28. 3333333

Potrebbero piacerti anche