Assignment solution
Student ID=bc 220421550
Question 1:
Compute absolute and relative errors, if the true value is 3.1416 and
the approximate value is 3.14.
Solution:
Let:
True value = 3.1416=T
Approximate value = 3.14=A
Absolute Error:
Absolute Error= |T – A| = |3.1416 – 3.14| = 0.0016
Relative Error:
{|T − A|} {0.0016 }
Relative Error= =
|T| { 3.1416 }
≈ 0.000509
Question 2:
Find one iteration of the Bisection method to approximate a root of
the equation in the interval .
Solution:
Let: F ( x )=x 3 – x – 2
Compute midpoint:
{ a+b }
C=
2
¿ { 1+2 } /{2 }=1.5
Evaluate:
F ( 1 ) =13 – 1 – 2=−2
3
F ( 2 ) =2 – 2 – 2=8 – 2 – 2=4
3
F ( 1.5 )=( 1.5 ) – 1.5 – 2=3.375 – 1.5 – 2=−0.125
Now check the sign:
F(1) . f(1.5) = (-2) .(-0.125) = 0.25 > 0
So, the root lies in [1.5,2]
Question #3
Solution 3
{f ( x 1 )( x1 – x 0 ) }
X 2 =x1 −
f ( x 1) – f ( x 0 ) }
Given:
F(x)= x^2 -2
x 0=1 x 1=2
, Step 1: Evaluate the function at and
2
F ( x 0 ) =f ( 1 )=1 – 2=−1
2
F ( x 1 )=f ( 2 )=2 – 2=4 – 2=2
Step 2: by Apply the Regula-Falsi formula
Final Answer:
4
X 2 = ≈1.333
3
This is the approximation of the root after one iteration using the Regula-Falsi
method.
Question 4 : Newton−Raphson Method
Solution
2
f ( x )=x −5 , x 0=2
Step1 :Compute the derivative
'
f ( x )=2 x
Step2 : Newton−Raphson formula
{f ( x n ) }
x n+1=x n −
{f ' ( x n ) }
Step3 : Substitute values
x 1=x 0−
{f ( x 0 ) } =2− {22−5 }
{f ' ( x0 ) } ( { 2 ⋅2 } )
¿ 2.25
Result after one iteration :
x 1=2.25
Question5 : Secant Method
Solution :
f ( x )=cos ( x )−x , x 0=0.5 , x 1=1.0
Secant method formula :
x n−x (n −1 ) }
x n+1=x n −f ( x n ) ⋅
f ( x n )−f ¿ ¿
Step1 :Compute function values
f ( x 0 ) =cos ( 0.5 )−0.5 ≈ 0.8776−0.5=0.3776
f ( x 1 ) =cos ( 1.0 )−1.0≈ 0.5403−1.0=−0.4597
Step2 : Plug into formula
X 2 =1.0−(−0.4597 ) ⋅ ¿ {1.0−0.5 }{−0.4597−0.3776 } { x ¿2=1.0+0.4597 ⋅¿ { 0.5 }{−0.8373 } ≈ 1.0−¿ { 0.22985 } { 0.837
Result after one iteration :
x 2 ≈ 0.725