summaryrefslogtreecommitdiff
path: root/260/CH4
diff options
context:
space:
mode:
Diffstat (limited to '260/CH4')
-rw-r--r--260/CH4/EX4.1/4_1.sce70
-rw-r--r--260/CH4/EX4.10/4_10.sce29
-rw-r--r--260/CH4/EX4.11/4_11.sce31
-rw-r--r--260/CH4/EX4.12/4_12.sce28
-rw-r--r--260/CH4/EX4.13/4_13.sce25
-rw-r--r--260/CH4/EX4.14/4_14.sce23
-rw-r--r--260/CH4/EX4.15/4_15.sce19
-rw-r--r--260/CH4/EX4.16/4_16.sce21
-rw-r--r--260/CH4/EX4.17/4_17.sce32
-rw-r--r--260/CH4/EX4.18/4_18.sce32
-rw-r--r--260/CH4/EX4.19/4_19.sce28
-rw-r--r--260/CH4/EX4.2/4_2.sce23
-rw-r--r--260/CH4/EX4.20/4_20.sce79
-rw-r--r--260/CH4/EX4.21/4_21.sce28
-rw-r--r--260/CH4/EX4.3/4_3.sce25
-rw-r--r--260/CH4/EX4.4/4_4.sce32
-rw-r--r--260/CH4/EX4.5/4_5.sce40
-rw-r--r--260/CH4/EX4.6/4_6.sce52
-rw-r--r--260/CH4/EX4.7/4_7.sce37
-rw-r--r--260/CH4/EX4.8/4_8.sce23
-rw-r--r--260/CH4/EX4.9/4_9.sce32
21 files changed, 709 insertions, 0 deletions
diff --git a/260/CH4/EX4.1/4_1.sce b/260/CH4/EX4.1/4_1.sce
new file mode 100644
index 000000000..21dd2091e
--- /dev/null
+++ b/260/CH4/EX4.1/4_1.sce
@@ -0,0 +1,70 @@
+//Eg-4.1
+//pg-139
+
+clear
+clc
+
+A=[-3 0 1];
+ xl=1;
+ xu=3;
+ fx=poly(A,'x','c')
+
+//This is used determine true root with less errors using bisection method
+//input arguments--xl(lower bound of x),xu(upper bound of x),es(stopping criterion error),f(given function)
+//output arguments--root(final value of x) obtained from my code,pre-percent relative error,itns-number of itertions used in the code
+
+xrold=(xl+xu)/2;
+
+//Verying whether in given interval,function are applicable for bisecion method
+
+if horner(fx,xl)*horner(fx,xu)>0 then
+ disp("there are more than 2 roots or no root ,so bisection method is not applicable")
+elseif horner(fx,xl)*horner(fx,xu)==0 then
+ disp("there is no need to apply any method since one of bound is a root")
+elseif horner(fx,xl)*horner(fx,xrold)==0|horner(fx,xrold)*horner(fx,xu)==0 then
+ disp("(xl+xu)/2 is the required root")
+
+else
+ //BISECTION METHOD
+ disp("The given function has only one root in the given interval ,so by applying bisection method root can be determined")
+ test=horner(fx,xl)*horner(fx,xrold);
+ if test<0 then
+ xu=xrold;
+ elseif test>0 then
+ xl=xrold;
+ else
+ root=xrold;
+ end
+ xrnew=(xl+xu)/2;
+ ea=abs(xrnew-xrold)*100/abs(xrnew);
+ pre(1,1)=ea;
+ iter=1;
+ itns(1,1)=1;
+ i=1;
+ while i<=10
+ printf('\n\nIteration No. %i \n',i);
+ printf('xlow=%f \n',xl);
+ printf('xhigh=%f \n',xu);
+ xrold=xrnew;
+ test=horner(fx,xl)*horner(fx,xrold);
+ if test<0 then
+ xu=xrold;
+ elseif test>0 then
+ xl=xrold;
+ else
+ root=xrold;
+
+end
+ xrnew=(xl+xu)/2;
+ fnew=horner(fx,xrnew);
+ ea=abs(xrnew-xrold)*100/abs(xrnew);
+ iter=iter+1;
+ itns(iter,1)=iter;
+ pre(iter,1)=ea;
+ i=i+1;
+ printf('xnew=%f \n',xrnew);
+ printf('fnew=%f \n',fnew);
+end
+root=xrnew;//True root
+end
+
diff --git a/260/CH4/EX4.10/4_10.sce b/260/CH4/EX4.10/4_10.sce
new file mode 100644
index 000000000..255b61639
--- /dev/null
+++ b/260/CH4/EX4.10/4_10.sce
@@ -0,0 +1,29 @@
+//Eg-4.10
+//pg-161
+
+clear
+clc
+
+
+// Secant Method
+
+A=[-6 5 -3 2];
+x1=0.5;
+x2=0.7;
+eps=10^(-10);
+fx=poly(A,'x','c');
+iter=1;
+Abserr=100;
+while Abserr>eps
+ printf('iteration number %i\n',iter);
+ xnew1=x2-horner(fx,x2)*(x2-x1)/(horner(fx,x2)-horner(fx,x1));
+ printf('xnew1 = %f \n',xnew1);
+ Abserr = abs(horner(fx,xnew1) - horner(fx,x1))/abs(horner(fx,xnew1));
+ x1=x2;
+ x2=xnew1;
+ iter=iter+1;
+end
+
+disp("result was found in iterations")
+disp(iter-1)
+
diff --git a/260/CH4/EX4.11/4_11.sce b/260/CH4/EX4.11/4_11.sce
new file mode 100644
index 000000000..740616998
--- /dev/null
+++ b/260/CH4/EX4.11/4_11.sce
@@ -0,0 +1,31 @@
+//Eg-4.11
+//pg-163
+
+clear
+clc
+
+// Secant Method
+
+clear ;
+close ;
+clc ;
+
+deff('[z]=f(x)','z=1.55*x^(-0.5)-7.2*x+8.1*x^2-4*x^3-1.3');
+iter=1;
+eps=10^(-10);
+x1=0.5;
+x2=1;
+imax=20;
+
+Abserr=100;
+while Abserr>eps&iter<imax
+ //printf('iteration number %i\n',iter);
+ xnew1=x2-feval(x2,f)*(x2-x1)/(feval(x2,f)-feval(x1,f));
+ //printf('xnew1 = %f \n',xnew1);
+ Abserr=abs(xnew1-x1)/abs(xnew1);
+ x1=x2;
+ x2=xnew1;
+ iter=iter+1;
+end
+
+printf('The result of %f has been found after %d iterations',x2,iter-1) \ No newline at end of file
diff --git a/260/CH4/EX4.12/4_12.sce b/260/CH4/EX4.12/4_12.sce
new file mode 100644
index 000000000..da24f074f
--- /dev/null
+++ b/260/CH4/EX4.12/4_12.sce
@@ -0,0 +1,28 @@
+//Eg-4.12
+//pg-165
+
+clear
+clc
+
+deff('[z]=f0(x0,x1)','z=x0^3-2.5*x1^2+4*x0-3.7');
+deff('[z]=f1(x0,x1)','z=0.7*x1^2+3*x1-1.8*x0+1');
+
+x0=0;
+x1=0;
+
+eps=10^-10;
+
+deff('[z]=df0(x0)','z=3*x0^2+4');
+deff('[z]=df1(x1)','z=-5*x1');
+deff('[z]=fd0(x0)','z=-1.8');
+deff('[z]=fd1(x1)','z=1.4*x1+3');
+for i=1:5
+Xold=[x0;x1];
+A=[feval(x0,df0) feval(x1,df1);feval(x0,fd0) feval(x1,fd1)];
+b=-[feval(x0,x1,f0);feval(x0,x1,f1)];
+Xnew=Xold+inv(A)*b;
+x0=Xnew(1);
+x1=Xnew(2);
+end
+
+disp(Xnew) \ No newline at end of file
diff --git a/260/CH4/EX4.13/4_13.sce b/260/CH4/EX4.13/4_13.sce
new file mode 100644
index 000000000..25d671f2a
--- /dev/null
+++ b/260/CH4/EX4.13/4_13.sce
@@ -0,0 +1,25 @@
+//Eg-4.13
+//pg-173
+
+clear
+clc
+
+clc;
+clear;
+
+
+x0=0.5;
+x1=0.5;
+x2=0.5;
+
+for i=1:6
+Xold=[x0;x1;x2];
+A=[2*cos(x0)*(sin(x0)-1)+2*sin(x0)*(cos(x1)-cos(x0)) 2*cos(x1)*(sin(x1)-1)+2*sin(x1)*(cos(x0)-cos(x1)) -2*(x2+0.25);cos(x0)*(x2+.25)+2*x2*(cos(x1)*cos(x0)+sin(x0)) -2*x2*sin(x0)*sin(x1) sin(x0)+2*(cos(x1)*sin(x0)-cos(x0));-2*x2*sin(x0)*sin(x1) (x2+.25)*cos(x1)+2*x2*(cos(x0)*cos(x1)+1.5*sin(x1)) sin(x1)+2*(sin(x1)*cos(x0)-1.5*cos(x1)) ];
+b=-[(1-sin(x0))^2+(1.5-sin(x1))^2+(cos(x0)-cos(x1))^2-(x2+0.25)^2;(x2+0.25)*sin(x0)+2*x2*(cos(x1)*sin(x0)-cos(x0));(x2+0.25)*sin(x1)+2*x2*(cos(x0)*sin(x1)-1.5*cos(x1))];
+Xnew=Xold+inv(A)*b;
+x0=Xnew(1);
+x1=Xnew(2);
+x2=Xnew(3);
+end
+
+disp(Xnew) \ No newline at end of file
diff --git a/260/CH4/EX4.14/4_14.sce b/260/CH4/EX4.14/4_14.sce
new file mode 100644
index 000000000..8785b761b
--- /dev/null
+++ b/260/CH4/EX4.14/4_14.sce
@@ -0,0 +1,23 @@
+//Eg-4.14
+//pg-179
+
+clear
+clc
+
+deff('[z]=f(x)','z=4*x^3+3*x^2+2*x+1');
+
+
+deriv=0;
+a=[1 2 3 4];
+F5=feval(5,f);
+F=a(4);
+x=5;
+for i=1:3
+ deriv=deriv*x+F;
+ F=F*x+a(4-i);
+end
+
+
+
+printf('The value of the function at x = 5 is %f\n',F5)
+printf(' The value of the derivative of the function at x = 5 is %f\n',deriv)
diff --git a/260/CH4/EX4.15/4_15.sce b/260/CH4/EX4.15/4_15.sce
new file mode 100644
index 000000000..be7e89720
--- /dev/null
+++ b/260/CH4/EX4.15/4_15.sce
@@ -0,0 +1,19 @@
+//Eg-4.15
+//pg-180
+
+clear
+clc
+
+
+//co-efficients of the polynomial
+a=[-6 11 -6 1];
+//one root
+l=1;
+n=4;
+for i=n-2:-1:1
+ b(n-1)=a(n);
+ b(i)=b(i+1)*l+a(i+1)
+end
+
+fdef=poly(b,'x','c');
+disp(fdef) \ No newline at end of file
diff --git a/260/CH4/EX4.16/4_16.sce b/260/CH4/EX4.16/4_16.sce
new file mode 100644
index 000000000..7952ea328
--- /dev/null
+++ b/260/CH4/EX4.16/4_16.sce
@@ -0,0 +1,21 @@
+//Eg-4.16
+//pg-182
+
+clear
+clc
+
+
+//co-efficients of the polynomial
+a=[6.3825 -21.52 21.26 -8 1];
+//one root
+l=3.7;
+n=5;
+for i=n-2:-1:1
+ b(n-1)=a(n);
+ b(i)=b(i+1)*l+a(i+1)
+end
+
+fdef=poly(b,'x','c');
+disp(fdef)
+printf('\nOr\n The coefficient matrix is \n')
+disp(b) \ No newline at end of file
diff --git a/260/CH4/EX4.17/4_17.sce b/260/CH4/EX4.17/4_17.sce
new file mode 100644
index 000000000..8fc0ef2b7
--- /dev/null
+++ b/260/CH4/EX4.17/4_17.sce
@@ -0,0 +1,32 @@
+//Eg-4.17
+//pg-184
+
+clear
+clc
+
+
+clc;
+clear;
+Aold=[1 -3 2 0 0];//4-7 terms are added inorder to satisfy condition no.84 in book
+n=0;
+r=1;
+//iterations are continued till 10^35
+while r/10^35 <= 1
+ for i=1:2
+ summ=0;
+ for k=1:i
+ summ=summ+2*((-1)^k)*Aold(i+k+1)*Aold(i+1-k);
+ end
+ Anew(i)=((-1)^i)*((Aold(i+1))^2+summ);
+ end
+ Aold=[1 Anew(1) Anew(2) 0 0 ];
+ r=max(abs(Anew));
+ n=n+1;
+end
+
+
+r1=abs(Anew(1))^(1/2^n);
+r2=abs(Anew(2)/Anew(1))^(1/2^n);
+
+disp(r1);
+disp(r2); \ No newline at end of file
diff --git a/260/CH4/EX4.18/4_18.sce b/260/CH4/EX4.18/4_18.sce
new file mode 100644
index 000000000..9828b90c5
--- /dev/null
+++ b/260/CH4/EX4.18/4_18.sce
@@ -0,0 +1,32 @@
+//Eg-4.18
+//pg-190
+
+clc;
+clear;
+
+//using the function graeffe.sci created.
+
+exec graf.sci
+clc
+eps1 = 0.01;
+eps2 = 0.001;
+
+
+printf('The solution to the problem (a) is \n')
+A1 = [1 3];
+q1 = graf(A1,eps1)
+printf('------------------------------------------------------\n')
+
+printf('The solution to the problem (b) is \n')
+A2 = [1 -4 3];
+q2 = graf(A2,eps1)
+printf('------------------------------------------------------\n')
+
+printf('The solution to the problem (c) is \n')
+A3 = [1 -7 14 -8];
+q3 = graf(A3,eps1);
+printf('------------------------------------------------------\n')
+
+printf('The solution to the problem 2 is \n')
+A = [1 -0.01678 1.76232*10^-5 -4.17671*10^-9];
+q4 = graf(A,eps2);
diff --git a/260/CH4/EX4.19/4_19.sce b/260/CH4/EX4.19/4_19.sce
new file mode 100644
index 000000000..f5ac2db40
--- /dev/null
+++ b/260/CH4/EX4.19/4_19.sce
@@ -0,0 +1,28 @@
+//Eg-4.19
+//pg-193
+
+clear
+clc
+
+
+a=[1 -14 71.74 -153.9 122.2525];
+
+b0=0;
+b01=1;
+g=-1;
+d=1;
+printf('The results for 10 iterations are presented below\n\n')
+printf(' i g d b1 b2 r1 r2\n')
+for i=1:10
+ b1=a(2)-g*b01-d*b0;
+ b2=a(3)-g*b1-d*b01;
+ r1=a(4)-g*b2-d*b1;
+ r2=a(5)-d*b2;
+ dnew=a(5)/b2;
+ gnew=(a(4)-dnew*b1)/b2;
+ d=dnew;
+ g=gnew;
+ printf(' %d %f %f %f %f %f %f\n',i,g,d,b1,b2,r1,r2)
+end
+
+ \ No newline at end of file
diff --git a/260/CH4/EX4.2/4_2.sce b/260/CH4/EX4.2/4_2.sce
new file mode 100644
index 000000000..4b0c67a63
--- /dev/null
+++ b/260/CH4/EX4.2/4_2.sce
@@ -0,0 +1,23 @@
+//Eg-4.2
+//pg-143
+
+clear
+clc
+
+xl=0;
+xu=1;
+for i=1:20
+ fl=xl-cos(xl);
+ fu=xu-cos(xu);
+ rt=(xl+xu)/2;
+ fr=rt-cos(rt);
+ if fl*fr<0 then
+ xu=(xl+xu)/2;
+ elseif fr*fu<0 then
+ xl=(xl+xu)/2;
+ else
+ rt=(xl+xu)/2;
+ end
+
+end
+printf('The solution after 20 iterations is %f',rt)
diff --git a/260/CH4/EX4.20/4_20.sce b/260/CH4/EX4.20/4_20.sce
new file mode 100644
index 000000000..fcc9a9743
--- /dev/null
+++ b/260/CH4/EX4.20/4_20.sce
@@ -0,0 +1,79 @@
+//Eg-4.20
+//pg-198
+
+clear
+clc
+
+
+a=[1 -10 50 -120 144];
+
+b0=0;
+b01=1;
+g=-1;
+d=1;
+for i=1:60
+ b1=a(2)-g*b01-d*b0;
+ b2=a(3)-g*b1-d*b01;
+ r1=a(4)-g*b2-d*b1;
+ r2=a(5)-d*b2;
+ dnew=a(5)/b2;
+ gnew=(a(4)-dnew*b1)/b2;
+ d=dnew;
+ g=gnew;
+end
+disp("Hence gamma delta b1 b2 are respectively")
+disp(g);
+disp(d);
+disp(b1);
+disp(b2);
+
+m=[8 -4 1];
+f=poly(m,'x','c');
+p=roots(f);
+disp("two roots are")
+disp(p);
+
+m=[18 -6 1];
+f=poly(m,'x','c');
+p=roots(f);
+disp("other two roots are");
+disp(p);
+
+
+disp("second part")
+
+a=[1 -8 27 -50 50];
+
+b0=0;
+b01=1;
+g=-1;
+d=1;
+for i=1:60
+ b1=a(2)-g*b01-d*b0;
+ b2=a(3)-g*b1-d*b01;
+ r1=a(4)-g*b2-d*b1;
+ r2=a(5)-d*b2;
+ dnew=a(5)/b2;
+ gnew=(a(4)-dnew*b1)/b2;
+ d=dnew;
+ g=gnew;
+end
+disp("Hence gamma delta b1 b2 are respectively")
+disp(g);
+disp(d);
+disp(b1);
+disp(b2);
+
+m=[5 -2 1];
+f=poly(m,'x','c');
+p=roots(f);
+disp("two roots are")
+disp(p);
+
+m=[10 -6 1];
+f=poly(m,'x','c');
+p=roots(f);
+disp("other two roots are");
+disp(p);
+
+
diff --git a/260/CH4/EX4.21/4_21.sce b/260/CH4/EX4.21/4_21.sce
new file mode 100644
index 000000000..8f9ea9d5c
--- /dev/null
+++ b/260/CH4/EX4.21/4_21.sce
@@ -0,0 +1,28 @@
+//Eg-4.21
+//pg-202
+
+clear
+clc
+
+
+//After complex root substitution a+ib
+
+deff('[z]=u(a,b)','z=a^2-b^2-2*a+2');
+deff('[z]=v(a,b)','z=2*a*b-2*b');
+deff('[z]=ua(a)','z=2*a-2');
+deff('[z]=ub(b)','z=-2*b');
+ain=0.5;
+bin=.5;
+
+for i=1:6
+ U=feval(ain,bin,u);
+ V=feval(ain,bin,v);
+ UA=feval(ain,ua);
+ UB=feval(bin,ub);
+ anew=ain+(V*UB-U*UA)/(UA^2+UB^2);
+ bnew=bin+(V*UA-U*UB)/(UA^2+UB^2);
+ ain=anew;
+ bin=bnew;
+end
+
+printf('\nThe complex root is %f + i(%f) \n',ain,bin)
diff --git a/260/CH4/EX4.3/4_3.sce b/260/CH4/EX4.3/4_3.sce
new file mode 100644
index 000000000..d6ec28d2d
--- /dev/null
+++ b/260/CH4/EX4.3/4_3.sce
@@ -0,0 +1,25 @@
+//Eg-4.3
+//pg-145
+
+clear
+clc
+
+
+ A=[-3 0 1];
+ [r,c] = size(A);
+ n = r;
+
+ xl=1;
+ xu=3;
+ fx=poly(A,'x','c')
+
+ // using formula |xnew^n-alpha|<=xhigh-xlow/2^n
+
+ xhigh=3;
+ xlow=1;
+
+ t = 1+ (6*2.303/log(2));
+ disp(t)
+ printf('Analytically 2^(1-n)<10^(-6), solving that implies n > %f\n so n = %d',t,t+1)
+
+ \ No newline at end of file
diff --git a/260/CH4/EX4.4/4_4.sce b/260/CH4/EX4.4/4_4.sce
new file mode 100644
index 000000000..cf59e091f
--- /dev/null
+++ b/260/CH4/EX4.4/4_4.sce
@@ -0,0 +1,32 @@
+//Eg-4.4
+//pg-147
+
+clear
+clc
+
+
+//False Position Method
+
+clear ;
+close ;
+clc ;
+//Coefficients of polynomial in increasing order of power of x
+A = [-2 1 -2 1];
+x1 = 1 ;
+x2 = 3 ;
+fx = poly(A,'x','c');
+for i = 1:20
+ printf('\n\nIteration No. %i \n',i);
+ fx1 = horner(fx,x1);
+ fx2 = horner(fx,x2);
+ x0 = x1 - fx1*(x2-x1)/(fx2-fx1)
+ printf('xnew = %f \n',x0);
+ fx0 = horner(fx,x0);
+ if fx1*fx0 < 0 then
+ x2 = x0 ;
+ else
+ x1 = x0 ;
+ end
+end
+
+printf('\n\nPlease note that the author has considered only 5 decimal places, but here we have taken 6 decimal places, so a minor difference in the answer may occur') \ No newline at end of file
diff --git a/260/CH4/EX4.5/4_5.sce b/260/CH4/EX4.5/4_5.sce
new file mode 100644
index 000000000..6703a8b09
--- /dev/null
+++ b/260/CH4/EX4.5/4_5.sce
@@ -0,0 +1,40 @@
+//Eg-4.5
+//pg-149
+
+clear
+clc
+
+
+//False Position Method
+
+clear ;
+close ;
+clc ;
+//Coefficients of polynomial in increasing order of power of x
+A = [-3.1622777 -1.2649111 -0.1264911 0 0 100];
+x1 = 0 ;
+x2 = 2 ;
+fx = poly(A,'x','c');
+printf('\n\nThe given equation can be modified and written in the following form after substituting the values of given constants\n')
+disp(fx)
+i = 0;
+eps = 1;
+
+while(eps > 10^(-6))
+ i = i+1;
+ //printf('\n\nIteration No. %i \n',i);
+ fx1 = horner(fx,x1);
+ fx2 = horner(fx,x2);
+ xnew = (x1*fx2 - x2*fx1)/(fx2-fx1);
+ fxnew = horner(fx,xnew);
+ //printf('xnew = %f \nfxnew = %f',xnew,fxnew);
+
+ if fx1*fxnew < 0 then
+ x2 = xnew ;
+ else
+ x1 = xnew ;
+ end
+ eps = abs(fxnew);
+end
+
+printf('\n\nThe result obtained after %d iterations is x = %f\n',i,xnew) \ No newline at end of file
diff --git a/260/CH4/EX4.6/4_6.sce b/260/CH4/EX4.6/4_6.sce
new file mode 100644
index 000000000..1695ccb55
--- /dev/null
+++ b/260/CH4/EX4.6/4_6.sce
@@ -0,0 +1,52 @@
+//Eg-4.6
+//pg-151
+
+clear
+clc
+
+// Method of Sucessive substitution
+
+clear ;
+close ;
+clc ;
+//Coefficients of polynomial in increasing order of power of x
+A = [0 0 1];
+
+//when G(x)=x^2
+x01 = 0.5;
+x02 = 1.5;
+t(1) = x01;
+fx = poly(A,'x','c');
+printf('\nFor G(x) = x^2\n\n')
+printf(' x0 itr xnew\n')
+for(i = 1:5)
+ xnew(i) = horner(fx,t(i))
+ t(i+1) = xnew(i);
+ printf('%f %d %f\n',x01,i,xnew(i))
+end
+p(1) = x02;
+for(i = 1:5)
+ xnew(i) = horner(fx,p(i))
+ p(i+1) = xnew(i);
+ printf('%f %d %f\n',x02,i,xnew(i))
+end
+
+
+//when g(x)=x^1/2
+
+deff('z=f(x)','z=x^(1/2)');
+printf('\nFor G(x) = x^0.5\n\n')
+printf(' x0 itr xnew\n')
+for i=1:5
+ xnew(i) = feval(t(i),f);
+ t(i+1) = xnew(i);
+ printf('%f %d %f\n',x01,i,xnew(i))
+end
+for i=1:5
+ xnew(i) = feval(p(i),f);
+ p(i+1) = xnew(i);
+ printf('%f %d %f\n',x02,i,xnew(i))
+end
+
+
+
diff --git a/260/CH4/EX4.7/4_7.sce b/260/CH4/EX4.7/4_7.sce
new file mode 100644
index 000000000..e520d423b
--- /dev/null
+++ b/260/CH4/EX4.7/4_7.sce
@@ -0,0 +1,37 @@
+//Eg-4.7
+//pg-154
+
+
+
+// Method of Sucessive substitution
+
+clear ;
+close ;
+clc ;
+//Coefficients of polynomial in increasing order of power of x
+
+x1=0.5;
+deff('[z]=f(x)','z=0.3*exp(x)');
+errorcheck=1;
+iter=1;
+eps=10^-8;
+imax=30;
+
+while errorcheck==1&iter<imax
+xnew=feval(x1,f);
+ printf('xnew = %f\n',xnew);
+
+abserr=abs(xnew-x1)/abs(xnew);
+x1=xnew;
+if abserr<=eps then
+ errorcheck=2;
+end
+iter=iter+1;
+end
+
+disp("The solution is")
+disp(x1)
+disp("no of iterations required")
+disp(iter)
+
+printf('\nSince the number of decimals used for calculations and that displayed are different the number of iterations is different from the book.') \ No newline at end of file
diff --git a/260/CH4/EX4.8/4_8.sce b/260/CH4/EX4.8/4_8.sce
new file mode 100644
index 000000000..f310fb243
--- /dev/null
+++ b/260/CH4/EX4.8/4_8.sce
@@ -0,0 +1,23 @@
+//Eg-4.8
+//pg-155
+
+clear
+clc
+
+
+// Newton Raphson Method
+
+A=[6 -5 1];
+x1=0.2;
+x2=4;
+fx=poly(A,'x','c');
+B=[-5 2];
+diffx=poly(B,'x','c');
+for i=1:6
+ printf('\niteration number %i\n',i-1);
+ xnew1=x1-horner(fx,x1)/horner(diffx,x1);
+ xnew2=x2-horner(fx,x2)/horner(diffx,x2);
+ printf('xnew1 = %f \nxnew2=%f\n',x1,x2);
+ x1=xnew1;
+ x2=xnew2;
+end \ No newline at end of file
diff --git a/260/CH4/EX4.9/4_9.sce b/260/CH4/EX4.9/4_9.sce
new file mode 100644
index 000000000..44c818eb4
--- /dev/null
+++ b/260/CH4/EX4.9/4_9.sce
@@ -0,0 +1,32 @@
+//Eg-4.9
+//pg-157
+
+clear
+clc
+
+
+// Newton Raphson Method
+
+A = [-150-(%pi*0.12*298)-%pi*0.12*0.8*5.67*10^(-8)*298^4 %pi*0.12*25 0 0 %pi*.12*.8*5.67*10^(-8)];
+x1 = 298;
+fx = poly(A,'x','c');
+B = [%pi*0.12*25 0 0 %pi*.12*4*.8*5.67*10^(-8)];
+diffx = poly(B,'x','c');
+disp(fx)
+disp(diffx)
+iter=1;
+
+eps=10^(-10);
+errorcheck=1;
+abserr = 1;
+
+while (abserr > eps)
+ printf('\niteration number %i\n',iter);
+ xnew1 = x1 - horner(fx,x1)/horner(diffx,x1);
+ printf('xnew1 = %f \n',xnew1);
+ abserr = abs((xnew1 - x1)/(x1)*100);
+ x1 = xnew1;
+ iter = iter + 1;
+end
+
+printf('\nThe solution obtained after %d iterations is %f\n',iter-1,xnew1) \ No newline at end of file