summaryrefslogtreecommitdiff
path: root/60/CH3
diff options
context:
space:
mode:
Diffstat (limited to '60/CH3')
-rwxr-xr-x60/CH3/EX3.1/ex_1.sce27
-rwxr-xr-x60/CH3/EX3.10/ex_10.sce19
-rwxr-xr-x60/CH3/EX3.11/ex_11.sce4
-rwxr-xr-x60/CH3/EX3.12/ex_12.sce8
-rwxr-xr-x60/CH3/EX3.14/ex_14.sce6
-rwxr-xr-x60/CH3/EX3.15/ex_15_a.sce5
-rwxr-xr-x60/CH3/EX3.16/ex_16.sce5
-rwxr-xr-x60/CH3/EX3.17.a/ex_17_a.sce19
-rwxr-xr-x60/CH3/EX3.2.a/ex_2_a.sce30
-rwxr-xr-x60/CH3/EX3.3/ex_3.sce11
-rwxr-xr-x60/CH3/EX3.4/ex_4.sce12
-rwxr-xr-x60/CH3/EX3.5/ex_5.sce5
-rwxr-xr-x60/CH3/EX3.8.a/ex_8_a.sce27
-rwxr-xr-x60/CH3/EX3.8/ex_8.sce32
14 files changed, 210 insertions, 0 deletions
diff --git a/60/CH3/EX3.1/ex_1.sce b/60/CH3/EX3.1/ex_1.sce
new file mode 100755
index 000000000..6eebf3bbc
--- /dev/null
+++ b/60/CH3/EX3.1/ex_1.sce
@@ -0,0 +1,27 @@
+ // Example(3.1)
+
+// finding roots using bisection method
+
+ deff('[y]=f(x)','y=x-0.2*sin(x)-0.5')
+ bisection(0.5,1.0,f)
+
+
+//regula falsi method
+
+deff('[y]=f(x)','y=x-0.2*sin(x)-0.5')
+regularfalsi(0.5,1.0,f)
+
+//secant method
+
+deff('[y]=f(x)','y=x-0.2*sin(x)-0.5')
+secant(0.5,1.0,f)
+
+
+//newton rapson method
+
+
+x=(0.5+1)/2
+deff('[y]=f(x)','y=x-0.2*sin(x)-0.5')
+deff ('[y]=g(x)','y=1-0.2*cos(x)')
+x=newton(x,f,g)
+
diff --git a/60/CH3/EX3.10/ex_10.sce b/60/CH3/EX3.10/ex_10.sce
new file mode 100755
index 000000000..855fd40df
--- /dev/null
+++ b/60/CH3/EX3.10/ex_10.sce
@@ -0,0 +1,19 @@
+//example(3.10)
+
+ c=[-3 1 0 1]]
+ p3=poly(c,'x','coeff')
+ roots(p3)
+ //here
+ xset('window',0);
+x=-2:.01:2.5; // defining the range of x.
+deff('[y]=f(x)','y=x^3+x-3'); //defining the cunction
+y=feval(x,f);
+
+a=gca();
+
+a.y_location = "origin";
+
+a.x_location = "origin";
+plot(x,y) // instruction to plot the graph
+
+title(' y =x^3+x-3') \ No newline at end of file
diff --git a/60/CH3/EX3.11/ex_11.sce b/60/CH3/EX3.11/ex_11.sce
new file mode 100755
index 000000000..6b0e5bef4
--- /dev/null
+++ b/60/CH3/EX3.11/ex_11.sce
@@ -0,0 +1,4 @@
+//example(3.11)
+ c=[-6.8 10.8 -10.8 7.4 -3.7 1]
+ p5=poly(c,'y','coeff')
+ roots(p5) \ No newline at end of file
diff --git a/60/CH3/EX3.12/ex_12.sce b/60/CH3/EX3.12/ex_12.sce
new file mode 100755
index 000000000..6dcab2fc3
--- /dev/null
+++ b/60/CH3/EX3.12/ex_12.sce
@@ -0,0 +1,8 @@
+//example(3.12)
+
+ c=[-5040 13068 -13132 6769 -1960 322 -28 1]
+ p7=poly(c,'y','coeff')
+ roots(p7)
+
+
+ \ No newline at end of file
diff --git a/60/CH3/EX3.14/ex_14.sce b/60/CH3/EX3.14/ex_14.sce
new file mode 100755
index 000000000..67075dbc2
--- /dev/null
+++ b/60/CH3/EX3.14/ex_14.sce
@@ -0,0 +1,6 @@
+//example(3.14)
+
+ c=[-3 1 0 1]
+ p3=poly(c,'y','coeff')
+ roots(p3)
+ \ No newline at end of file
diff --git a/60/CH3/EX3.15/ex_15_a.sce b/60/CH3/EX3.15/ex_15_a.sce
new file mode 100755
index 000000000..187c4a550
--- /dev/null
+++ b/60/CH3/EX3.15/ex_15_a.sce
@@ -0,0 +1,5 @@
+//example(3.15)
+
+c=[-6.8 10.8 -10.8 7.4 -3.7 1]
+p5=poly(c,'x','coeff')
+roots(p5)
diff --git a/60/CH3/EX3.16/ex_16.sce b/60/CH3/EX3.16/ex_16.sce
new file mode 100755
index 000000000..528605160
--- /dev/null
+++ b/60/CH3/EX3.16/ex_16.sce
@@ -0,0 +1,5 @@
+//example(3.16)
+
+c=[-5040 13068 -13132 6769 -1960 322 -28 1]
+p7=poly(c,'x','coeff')
+roots(p7)
diff --git a/60/CH3/EX3.17.a/ex_17_a.sce b/60/CH3/EX3.17.a/ex_17_a.sce
new file mode 100755
index 000000000..37b01c035
--- /dev/null
+++ b/60/CH3/EX3.17.a/ex_17_a.sce
@@ -0,0 +1,19 @@
+//example(3.17)
+
+ c=[51200 0 -39712 0 7392 0 -170 0 1 ]
+ p8=poly(c,'x','coeff')
+roots(p8)
+
+ xset('window',0);
+x=-11:01:11; // defining the range of x.
+deff('[y]=f(x)','y=x^8-170*x^6+7392*x^4-39712*x^2+51200'); //defining the cunction
+y=feval(x,f);
+
+a=gca();
+
+a.y_location = "origin";
+
+a.x_location = "origin";
+plot(x,y) // instruction to plot the graph
+
+title(' y =x^8-170*x^6+7392*x^4-39712*x^2+51200')
diff --git a/60/CH3/EX3.2.a/ex_2_a.sce b/60/CH3/EX3.2.a/ex_2_a.sce
new file mode 100755
index 000000000..684d1b91e
--- /dev/null
+++ b/60/CH3/EX3.2.a/ex_2_a.sce
@@ -0,0 +1,30 @@
+//example(3.2a)
+
+
+//bisection method
+
+deff('[y]=f(x)','y=x^3-x-1')
+bisection(1.0,1.5,f)
+
+
+//regula falsi method
+
+deff('[y]=f(x)','y=x^3-x-1')
+regularfalsi(1.0,1.5,f)
+
+//secant method
+
+deff('[y]=f(x)','y=x^3-x-1')
+secant(1.0,1.5,f)
+
+
+//newton rapson method
+
+
+x=(0.5+1)/2
+deff('[y]=f(x)','y=x^3-x-1')
+deff('[y]=g(x)','y=1-0.2*cos(x)')
+
+newton(x,f,g)
+
+
diff --git a/60/CH3/EX3.3/ex_3.sce b/60/CH3/EX3.3/ex_3.sce
new file mode 100755
index 000000000..5f1682688
--- /dev/null
+++ b/60/CH3/EX3.3/ex_3.sce
@@ -0,0 +1,11 @@
+//example(3.3)
+
+ //here f(x)=e^(-x)-sin(x) ,according to fixed point iteration we take g(x)=x=x+e^(-x)-sin(x);
+ // so, xn=g(xn)
+deff('[y]=g(x)','y=x+(2.718)^(-x)-sin(x)')
+x=0.6
+for n=1:1:18
+ g(x);
+ x=g(x)
+end
+
diff --git a/60/CH3/EX3.4/ex_4.sce b/60/CH3/EX3.4/ex_4.sce
new file mode 100755
index 000000000..d8257f336
--- /dev/null
+++ b/60/CH3/EX3.4/ex_4.sce
@@ -0,0 +1,12 @@
+//example(3.4)
+
+ //here f(x)=1.5*x-tan(x)-0.1=0, according to fixed point iteration we get x=(0.1+tan(x))/1.5
+ //where g(x)=x=(0.1+tan(x))/1.5
+ //& xn=g(xn)
+deff('[y]=g(x)','y=(0.1+tan(x))/1.5')
+x=0
+
+for n=1:1:10
+ g(x);
+ x=g(x)
+end
diff --git a/60/CH3/EX3.5/ex_5.sce b/60/CH3/EX3.5/ex_5.sce
new file mode 100755
index 000000000..6f257fcd4
--- /dev/null
+++ b/60/CH3/EX3.5/ex_5.sce
@@ -0,0 +1,5 @@
+//example(3.5)
+
+deff ('[y]=f(x)','y=x^3-x-1')
+secant(1.0,1.5,f)
+
diff --git a/60/CH3/EX3.8.a/ex_8_a.sce b/60/CH3/EX3.8.a/ex_8_a.sce
new file mode 100755
index 000000000..8b1bc7e35
--- /dev/null
+++ b/60/CH3/EX3.8.a/ex_8_a.sce
@@ -0,0 +1,27 @@
+//example(pg no.111)
+
+
+//a,b & f are the modulus coeff of x^0,x^1,x^5
+ c=[-6.8 10.8 -10.8 7.4 -3.7 1]
+ a=6.8;
+ b=10.8;
+ f=1;
+ n=5
+ p5=poly(c,'x','coeff')
+ p=n*a/b
+ q=a/f^(1/n)
+ roots(p4)
+
+ xset('window',0);
+x=-2:.01:2.5; // defining the range of x.
+deff('[y]=f(x)','y=x^5-3.7*x^4+7.4*x^3-10.8*x^2+10.8*x-6.8'); //defining the cunction
+y=feval(x,f);
+
+a=gca();
+
+a.y_location = "origin";
+
+a.x_location = "origin";
+plot(x,y) // instruction to plot the graph
+
+title(' y = 8*x^3-12*x^2-2*x+3') \ No newline at end of file
diff --git a/60/CH3/EX3.8/ex_8.sce b/60/CH3/EX3.8/ex_8.sce
new file mode 100755
index 000000000..abe849985
--- /dev/null
+++ b/60/CH3/EX3.8/ex_8.sce
@@ -0,0 +1,32 @@
+//example(3.8)
+
+
+
+ //a,b & e are the modulus coeff of x^0,x^1,x^4
+ c=[-1 1 -1 -1 1]
+a=1;
+b=1;
+e=1;
+ n=4
+ p4=poly(c,'x','coeff')
+ p=n*a/b
+ q=(a/e)^(1/n)
+ roots(p4)
+ //from here we found that only 2 real roots,other two are complex roots
+ xset('window',0);
+x=-2:0.1:3; // defining the range of x.
+deff('[y]=f(x)','y=x^4-x^3-x^2+x-1'); //defining the function
+y=feval(x,f);
+
+a=gca();
+
+a.y_location = "origin";
+
+a.x_location = "origin";
+plot(x,y) // instruction to plot the graph
+
+title(' y =x^4-x^3-x^2+x-1')
+
+
+
+ \ No newline at end of file