Professional Documents
Culture Documents
Question 02
Question 02
Question 02
x
-1.0 -0.5 0.5 1.0 1.5 2.0
-1
Out[4]=
-2
-3
-4
-5
In[5]:= a = N[0];
b = a - (f[a]) / (f '[a]);
i = 1;
output = {{a, b, f[a], f '[a]}};
While[i ≤ 6, If[f '[a] ≠ 0, a = b]; b = a - (f[a]) / (f '[a]);
i = i + 1; output = Append[output, {a, b, f[a], f '[a]}]];
Print[NumberForm[TableForm[output,
TableHeadings → {Automatic, {"a", "b", "f[a]", "f'[a]"}}], 8]];
Print["Approximate value of the root=", b];
a b f[a] f'[a]
1 0. 1. -1. 1.
2 1. 0.88606174 0.15284487 1.341471
3 0.88606174 0.88451094 0.0020234667 1.3047923
4 0.88451094 0.88451062 4.2278845 × 10-7 1.3042468
5 0.88451062 0.88451062 1.8540725 × 10-14 1.3042467
6 0.88451062 0.88451062 0. 1.3042467
7 0.88451062 0.88451062 0. 1.3042467
Approximate value of the root=0.884511