Professional Documents
Culture Documents
Numerical Solution of Algebraic and Transcendental Equation. - Annotated
Numerical Solution of Algebraic and Transcendental Equation. - Annotated
Numerical Solution of Algebraic and Transcendental Equation. - Annotated
Que.1. Find a real root of the equation f(x)= x-x-1=0 correct to three decimal places
using Bisection method and Maxima software.
(%i1) f(x):=x^3-x-1;
(%o1) f(x):=x^3-x-1
(%i4) f(0);f(1);f(2);
(%o2) -1
(%o3) -1
(%o4) 5
(%i5) f(1)*f(2);
(%o5) -5
(%i6) wxplot2d(x^3-x-1,[x,0,3]);
(%t6)
(%o6)
Therefore real root lies between 1 and 2 , suppose the approximate value of the root is
(%i8) a:1;b:2;
(a) 1
(b) 2
(%i9) x_0:(a+b)/2.0;
(x_0) 1.5
(%i10) f(x_0);
(%o10) 0.875
(%i11) f(a)*f(x_0);
(%o11) -0.875
(x_1) 1.25
(%i13) f(x_1);
(%o13) -0.296875
(%i14) f(x_0)*f(x_1);
(%o14) -0.259765625
(%i15) x_2:(x_0+x_1)/2;
(x_2) 1.375
(%i16) f(x_2);
(%o16) 0.224609375
(%i17) x_3:(x_1+x_2)/2.0;
(x_3) 1.3125
(%i18) f(x_3);
(%o18) -0.051513671875
Similarly we can find x_4=1.34375 , x_5=1.328125 , x_6= 1.3203125 , x_7= 1.3251953 and
so on .
(%i1) f(x):=2*x-(log(x)/log(10))-7;
(%o1) f(x):=2*x-log(x)/log(10)-7
(%i5) float(f(1));float(f(2));float(f(3));float(f(4));
(%o2) -5.0
(%o3) -3.301029995663981
(%o4) -1.477121254719662
(%o5) 0.3979400086720377
(%i6) wxplot2d(2*x-(log(x)/log(10))-7,[x,3,4]);
(%t6)
(%o6)
(%i8) x_0:3;x_1:4;
(x_0) 3
(x_1) 4
(%i9) x_2:float((x_0*f(x_1)-x_1*f(x_0))/(f(x_1)-f(x_0)));
(x_2) 3.78777226299677
(%i10) float(f(x_2));
(%o10) -0.002839333488418694
Hence the root of the equation lies between x_2=3.78777226299677 and x_1=4
(%i11) x_3:float((x_2*f(x_1)-x_1*f(x_2))/(f(x_1)-f(x_2)));
(x_3) 3.789275796880518
(%i12) float(f(x_3));
(%o12) -4.622151150934783*10^-6
Hence the root of the equation lies between x_3=3.789275796880518 and x_1=4
(%i13) x_4:float((x_3*f(x_1)-x_1*f(x_3))/(f(x_1)-f(x_3)));
(x_4) 3.789278244454986
(%i14) float(f(x_4));
(%o14) -7.522240164092864*10^-9
Hence the root of the equation lies between x_4=3.789278244454986 and x_1=4
(%i15) x_5:float((x_4*f(x_1)-x_1*f(x_4))/(f(x_1)-f(x_4)));
(x_5) 3.78927824843825
(%i16) float(f(x_5));
(%o16) -1.224143009181944*10^-11
Similarly we can do the further iterations. Hence the root of the equation is 3.7892782484
x
Que.3. Find the real root correct to five decimal places of the equation x e - 4 =0
near x=0.5 by Newton-Raphson method using maxima software.
(%i1) load("newton1");
(%o1) "C:\maxima-5.42.1\share\maxima\5.42.1\share\numeric\newton1.mac"
(%i2) f(x):=x*(%e^x)-4;
(%o2) f(x):=x*%e^x-4
(%i3) newton(x*(%e^x)-4,x,0.5,1/1000);
(%o3) 1.202167958618543