diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /1332/CH5/EX5.4 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '1332/CH5/EX5.4')
-rwxr-xr-x | 1332/CH5/EX5.4/5_4.pdf | bin | 0 -> 6585 bytes | |||
-rwxr-xr-x | 1332/CH5/EX5.4/5_4.sce | 25 |
2 files changed, 25 insertions, 0 deletions
diff --git a/1332/CH5/EX5.4/5_4.pdf b/1332/CH5/EX5.4/5_4.pdf Binary files differnew file mode 100755 index 000000000..994484bfe --- /dev/null +++ b/1332/CH5/EX5.4/5_4.pdf diff --git a/1332/CH5/EX5.4/5_4.sce b/1332/CH5/EX5.4/5_4.sce new file mode 100755 index 000000000..c4e4e4c5b --- /dev/null +++ b/1332/CH5/EX5.4/5_4.sce @@ -0,0 +1,25 @@ +//Example 5.4
+//Ridders Method
+//Page no. 153
+clc;clear;close;
+deff('y=f(x)','y=x^3-3*x-5')
+x1=2;x2=3;e=0.00001
+printf('n\tx1\t\tf(x1)\t\tx2\t\tf(x2)\t\tx3\t\tf(x3)\t sign\t x4')
+printf('\n----------------------------------------------------------------------------------------------------------\n')
+for i=0:8
+ x3=(x1+x2)/2
+ a=f(x1)-f(x2);
+ s=a*abs(1/a)
+ x4=x3+(x3-x2)*(s*f(x3))/sqrt(f(x3)-f(x1)*f(x2))
+ printf(' %i\t%f\t%f\t%f\t%f\t%f\t%f %i\t%f\n',i,x1,f(x1),x2,f(x2),x3,f(x3),s,x4)
+ if f(x1)*f(x4)>0 then
+ x1=x4
+ else
+ x2=x4
+ end
+ if abs(f(x4))<e then
+ break
+ end
+end
+printf('\n\nThe solution of this equation is %g after %i Iterations',x4,i)
+printf('\n\n\nThere are computation error in the answers given by the book in this example\n\n(value of x1 is used instead of x2)')
\ No newline at end of file |