summaryrefslogtreecommitdiff
path: root/1670/CH2/EX2.6
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1670/CH2/EX2.6
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 '1670/CH2/EX2.6')
-rwxr-xr-x1670/CH2/EX2.6/2_6.pdfbin0 -> 6336 bytes
-rwxr-xr-x1670/CH2/EX2.6/2_6.sce20
2 files changed, 20 insertions, 0 deletions
diff --git a/1670/CH2/EX2.6/2_6.pdf b/1670/CH2/EX2.6/2_6.pdf
new file mode 100755
index 000000000..a2dfdd580
--- /dev/null
+++ b/1670/CH2/EX2.6/2_6.pdf
Binary files differ
diff --git a/1670/CH2/EX2.6/2_6.sce b/1670/CH2/EX2.6/2_6.sce
new file mode 100755
index 000000000..a1bb3aa0e
--- /dev/null
+++ b/1670/CH2/EX2.6/2_6.sce
@@ -0,0 +1,20 @@
+//Example 2.6
+//Secant Method
+//Page no. 19
+clc;clear;close;
+deff('x=f(x)','x=cos(x)-x*exp(x)')
+deff('x=f1(x)','x=-sin(x)-exp(x)-x*exp(x)')
+printf('n\txn\t\tf(xn)\t\tXn+1\t\tf(Xn+1)\t\tXn+2\t\tError\n')
+printf('----------------------------------------------------------------------------------------------------------\n')
+x0=0;x1=1;e=0.00001
+for i=1:6
+ x2=x1-f(x1)*(x1-x0)/(f(x1)-f(x0))
+ e1=abs(x0-x2)
+ printf(' %i\t%.10f\t%.10f\t%.10f\t%.10f\t%.10f\t%.10f\n',i-1,x0,f(x0),x1,f(x1),x2,e1)
+ x0=x1;
+ x1=x2
+ if abs(x0)<e then
+ break;
+ end
+end
+printf('\n\nTherefore, the root is %.4f correct upto 4 decimal places',x2) \ No newline at end of file