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

Assignment2

The document contains solutions to four mathematical problems involving calculations of functions, relative errors, and the bisection method for finding roots. The first two questions compute values and relative errors for given functions, while the third and fourth questions utilize the bisection method to approximate roots of equations. The final result for the last problem approximates √5 as 2.235331563.

Uploaded by

omarsherief247
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment2

The document contains solutions to four mathematical problems involving calculations of functions, relative errors, and the bisection method for finding roots. The first two questions compute values and relative errors for given functions, while the third and fourth questions utilize the bisection method to approximate roots of equations. The final result for the last problem approximates √5 as 2.235331563.

Uploaded by

omarsherief247
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Assignment 2

Name:Omar Sherief AbdelGhany Ahmed


Code:2227193
Question 1:

𝑓=
u− vw
v
2 -w

∆u ⁓
=0.1 u =1.5


∆ v =0.006 v

=-2
∆w =0.02 w =3
⁓ ⁓

At final we get

F(u ,w , v )=-1.125
⁓ ⁓ ⁓

∆F(u ,w ,v )=0.03725
⁓ ⁓ ⁓

Then the % of the rel.error=


⁓ ⁓ ⁓
Δ f (u , w , v )
| f (u , w , v ) ∨¿ *100%=3.311%
⁓ ⁓ ⁓
Question2:

3 4 3
x y +z y
f(x,y,z)= z

∆x ⁓
=0 x =1

∆ y =0

.2 y

=2
∆z =0.3 z =1
⁓ ⁓

At final we get

F(x , y ,z )=18
⁓ ⁓ ⁓

∆F(x , y ,z )=2.2 ⁓ ⁓ ⁓

Then the % of the rel.error=


⁓ ⁓ ⁓
Δ f (x , y , z )
| f (u⁓ , w ⁓ , v ⁓ )
∨¿ *100%=12.222222222%
Question3 :

3- Use the bisection method to find a root


of the equation 𝑥2 = −sin 𝑥
in the interval [-1, 0] with 𝜀𝑠 = 0.06%.

We will solve the equation x2+sin(x)=0


1st iteration
xL=-1 ==> f(xL)=0.98
xu=0 ==> f(xu)=0
1
Xr =- 2 ==> f(xr)=0.241
f(xu) is neither positive or negative
f(xl) and f(xr) are the same sign
Then xL=xr in the 2-nd iteration
2-nd iteration
xL=-0.5 ==> f(xL)=0.241
xu=0 ==> f(xu)=0
1
Xr =- 4 ==> f(xr)=0.058
f(xu) is neither positive or negative
f(xl) and f(xr) are the same sign
Then xL=xr in the 3-rd iteration
x r (new)− xr (old )
%ea=| xr (new) |=1

Question 4:

To approximate √5 we have the equation


x
2
- 5 =0 ==> xL =2 and xu =3

1-st iteration
xL =2 and xu = 3 ==> xr =2.5
F(xL) =-1 f(xu)=4 f(xr)=1.25
f(xr).F(xL) <0 then take xu =xr

2-nd iteration
xL =2 and xu = 2.5 ==> xr =2.25
F(xL) =-1 f(xu)=1.25 f(xr)=0.0625
f(xr).F(xL) <0 then take xu =xr

3-rd iteration
xL =2 and xu = 2.25 ==> xr =2.125
F(xL) =-1 f(xu)=0.0625 f(xr)=-0.484375
f(xr).F(xL) >0 then take xL=xr

4-th iteration
xL =2.125 and xu = 2.25 ==> xr =2.1875
F(xL) =-0.484375 f(xu)=0.0625 f(xr)=-0.2148
f(xr).F(xL) >0 then take xL=xr

5-th iteration
xL =2.1875 and xu = 2.25 ==> xr =2.21875
F(xL) =-0.484375 f(xu)=0.0625 f(xr)=-0.2148
f(xr).F(xL) >0 then take xL=xr

6-th iteration
xL =2.21875 and xu = 2.25 ==> xr =2.234375
F(xL) =-0.0077 f(xu)=0.0625 f(xr)=-0.00756
f(xr).F(xL) >0 then take xL=xr

7-th iteration
xL =2.234375 and xu = 2.25 ==> xr =2.2421875
F(xL) =-0.00756 f(xu)=0.0625 f(xr)=0.027
x r (new)− xr (old )
%ea=| xr (new) |≈0.35% >%es
f(xr).F(xL) >0 then take xu=xr

8-th iteration
xL =2.234375 and xu = 2.2421875
==> xr =2.23828125
F(xL) =-0.00756 f(xu)=0.027 f(xr)≈0.01
x r (new)− xr (old )
%ea=| xr (new) |≈0.175% >%es
f(xr).F(xL) >0 then take xu=xr;

9-th iteration
xL =2.234375 and xu =2.23828125
==> xr =2.236328125
F(xL) =-0.00756 f(xu)=0.01 f(xr)≈0.00116
x r (new)− xr (old )
%ea=| xr (new) |≈0.09% >%es
f(xr).F(xL) <0 then take xu=xr;

10-th iteration
xL =2.234375 and xu =2.236328125
==> xr =2.235331563
F(xL) =-0.00756 f(xu)=0.00116 f(xr)≈-0.32
x r (new)− xr (old )
%ea=| xr (new) |≈0.04% <%es

Then the Xr=2.235331563

You might also like