Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

BC230209391

Namra Saleem
MTH603
Assignment #1

Solution #1:

Here xe^x - 3 = 0
f(x) = xe^x - 3
Let x0=1 and x1=1.5

1st iteration:
Here f(1) = -0.2817<0 and f(1.5) = 3.7225 >0
Now, root lies between x0 =1 and x1 = 1.5
x 1−x 0
x2 = x1 - f(x1).
f (x 1)−f (x 0)
1.5−1
x2 = 1.5 - 3.7225.
3.7225−(−0.2817)
x2 = 1.0352
f(x2) = f(1.0352) = 1.0352e^1.0352 - 3 = -0.0853 <0

2nd iteration:
Here f(1.0352) = -0.0853<0 and f(1.5) = 3.7225 >0
Now, root lies between x0 =1.0352 and x1 = 1.5
x 2−x 1
x3 = x2 - f(x2).
f (x 2)−f (x 1)
1.0352−1.5
x3 = 1.0352 -(-0.0853).
−0.0853−3.7225
x3 = 1.0456
f(x3) = f(1.0456) = 1.0456e^1.0456 - 3 = -0.0251

3rd iteration:
Here f(1.0456) = -0.0251<0 and f(1.5) = 3.7225 >0
Now, root lies between x3 =1.0456 and x1 = 1.5
x 3−x 1
x4 = x3 - f(x3).
f (x 3)−f (x 1)
1.0456−1.5
x4 = 1.0456 -(-0.0251).
−0.0251−3.7225
x4 = 1.0486
f(x4) = f(1.0486) = 1.0486e^1.0486 - 3 = -0.0076

4th iteration:
Here f(1.0486) = -0.0076<0 and f(1.5) = 3.7225 >0
Now, root lies between x4 =1.0486 and x1 = 1.5
x 4−x 1
x5 = x4 - f(x4).
f (x 4 )−f ( x 1)
1.0486−1.5
x5 = 1.0486 -(-0.0076).
−0.0076−3.7225
x5 = 1.0495

Solution #2:

f(x)=sinx-1-x^3
f’(x)=cos(x)-3x^2

Initial value:
x0 = -1.1

1st iteration:
f(x0) = f(-1.1) = sin(-1.1)-1-(-1.1)^3 = -0.56
f’(x0) = f‘(-1.1) = cos(-1.1)-3(-1.1)^2 = -3.176

f (x 0)
x1 = x0 -
f '( x 0)
−0.56
x1 = (-1.1) -
−3.176
x1 = -1.276

2nd iteration:
f(x1) = f(-1.276) = sin(-1.276)-1-(-1.276)^3 = 0.121
f’(x1) = f‘(-1.276) = cos(-1.276)-3(-1.276)^2 = -4.597

f (x 1)
x2 = x1 -
f '( x 1)
0.121
x2 = (-1.276) -
−4.597
x2 = -1.25

3rd iteration:
f(x2) = f(-1.25) = sin(-1.25)-1-(-1.25)^3 = 0.003
f’(x2) = f‘(-1.25) = cos(-1.25)-3(-1.25)^2 = -4.37

f (x 2)
x3 = x2 -
f '( x 2)
0.003
x3 = (-1.25) -
−4.37
x3 = -1.24

You might also like