summaryrefslogtreecommitdiff
path: root/50/CH2/EX2.9
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /50/CH2/EX2.9
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '50/CH2/EX2.9')
-rwxr-xr-x50/CH2/EX2.9/2_9.PNGbin0 -> 10478 bytes
-rwxr-xr-x50/CH2/EX2.9/ex_9.sce37
2 files changed, 37 insertions, 0 deletions
diff --git a/50/CH2/EX2.9/2_9.PNG b/50/CH2/EX2.9/2_9.PNG
new file mode 100755
index 000000000..a172ae0c6
--- /dev/null
+++ b/50/CH2/EX2.9/2_9.PNG
Binary files differ
diff --git a/50/CH2/EX2.9/ex_9.sce b/50/CH2/EX2.9/ex_9.sce
new file mode 100755
index 000000000..5fdd426b7
--- /dev/null
+++ b/50/CH2/EX2.9/ex_9.sce
@@ -0,0 +1,37 @@
+ // The equation cos(x)-x*%e^x==0 has real roots.
+ // the graph of this function can be observed here.
+xset('window',8);
+x=-1:.001:2; // defining the range of x.
+deff('[y]=f(x)','y=cos(x)-x*%e^x'); //defining the cunction.
+deff('[y]=fp(x)','y=-sin(x)-x*%e^x-%e^x');
+y=feval(x,f);
+
+a=gca();
+
+a.y_location = "origin";
+
+a.x_location = "origin";
+plot(x,y) // instruction to plot the graph
+title(' y = cos(x)-x*%e^x')
+
+// from the above plot we can infre that the function has root between
+// the interval (0,1)
+
+
+// a=0;b=1,
+
+
+
+ // solution by newton raphson's method with a permissible error of 10^-8.
+
+
+// we call a user-defined function 'newton' so as to find the approximate
+// root of the equation within the defined permissible error limit.
+
+newton(1,f,fp)
+
+
+
+
+
+// hence the approximate root witin the permissible error of 10^-8 is 0.5177574. \ No newline at end of file