summaryrefslogtreecommitdiff
path: root/50/CH2/EX2.4
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.4
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.4')
-rwxr-xr-x50/CH2/EX2.4/2_4.PNGbin0 -> 10551 bytes
-rwxr-xr-x50/CH2/EX2.4/ex_4.sce32
2 files changed, 32 insertions, 0 deletions
diff --git a/50/CH2/EX2.4/2_4.PNG b/50/CH2/EX2.4/2_4.PNG
new file mode 100755
index 000000000..e111288e6
--- /dev/null
+++ b/50/CH2/EX2.4/2_4.PNG
Binary files differ
diff --git a/50/CH2/EX2.4/ex_4.sce b/50/CH2/EX2.4/ex_4.sce
new file mode 100755
index 000000000..751cc0f5c
--- /dev/null
+++ b/50/CH2/EX2.4/ex_4.sce
@@ -0,0 +1,32 @@
+ // The equation cos(x)-x*%e^x==0 has real roots.
+ // the graph of this function can be observed here.
+xset('window',3);
+x=0:.01:2; // defining the range of x.
+deff('[y]=f(x)','y=cos(x)-x*%e^x'); //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 = 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,
+
+// we call a user-defined function 'bisection' so as to find the approximate
+// root of the equation with a defined permissible error.
+
+bisection(0,1,f)
+
+// since in the example 2.4 we have been asked to perform 5 itterations ,
+
+bisection5(0,1,f)
+
+
+// hence the approximate root after 5 iterations is 0.515625 witin the permissible error of 10^-4, \ No newline at end of file