MTH603
Assignment 1
ID: BC190206698
Question:
Find the roots of the equation −x e x + cos x=0 up to two iterations by using
1. Newton Raphson Method (Take x 0=0.5 )
2. Secant Method (Take x 0=0 and x 1=1)
3. Bisection Method (Take [0.5, 1]).
Solution:
f(x)=−xex+cos(x)
1. Newton-Raphson Method
The Newton-Raphson formula for finding the root of f(x)=0 is:
xn+1=xn−f(xn)/f′(xn)x
where f(x)=−xex+cos(x) and we need the derivative f′(x).
Derivative Calculation
f′(x)=−ex−xex−sin(x)
Let’s take,
Starting with x0=0.5, we calculate two iterations.
Iteration Steps
1. First Iteration:
x1= x0−f(x0)/f′(x0)
Substituting x0=0.5:
x1≈0.5180
Second Iteration:
x2=x1−f(x1)f′(x1)
Substituting x1=0.5180:
x2≈0.5178
Results after two iterations:
x1=0.5180
x2=0.5178
2. Secant Method
The Secant Method formula for finding the root of f(x)=0f(x) = 0f(x)=0 is:
xn+1=xn−f(xn)*xn−(xn−1)/f(xn)−f(xn−1)
Let’s take:
We start with x0=0 and x1=1, and perform two iterations.
Iteration Steps
1. First Iteration:
x2=x1−f(x1)*(x1−x0)/ f(x1)−f(x0)
Substituting x0=0 and x1=1:
x2≈0.3147
2. Second Iteration:
x3=x2−f(x2) * (x2−x1) /f(x2)−f(x1)
Substituting x1=1 and x2=0.3147:
x3≈0.4467
Results after two iterations:
x2=0.3147
x3=0.4467
3. Bisection Method
Initial Interval
Given interval: [0.5,1]
Iteration Steps
1. First Iteration:
o Midpoint:
c1=0.5+1/2=0.75
o Evaluate f(c1)
Since f(0.5)*f(0.75)<0,
Now, we choose the new interval [0.5,0.75],
2. Second Iteration:
o New midpoint:
c2=0.5+0.752=0.625
o Evaluate f(c2):
Since f(0.5)*f(0.625)<0
We choose the new interval [0.5,0.625],
3. Third Iteration (Root Estimate):
o Midpoint: c3=0.5+0.625/2= 0.5625
Results after two iterations:
Midpoints for root estimation:
c1=0.75
c2=0.625,
and c3=0.5625 (approximate root)