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 /1670/CH7/EX7.12 | |
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 '1670/CH7/EX7.12')
-rwxr-xr-x | 1670/CH7/EX7.12/7_12.sce | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/1670/CH7/EX7.12/7_12.sce b/1670/CH7/EX7.12/7_12.sce new file mode 100755 index 000000000..f66bf046f --- /dev/null +++ b/1670/CH7/EX7.12/7_12.sce @@ -0,0 +1,31 @@ +//Example 7.12
+//Stirlings Central Difference Derivatives
+//Page no. 248
+clc;close;clear;
+printf(' x\t y\t d\t d2\t d3\t d4\n')
+printf('------------------------------------------------')
+function [x]=f(x1)
+ x=0;
+ for i=3:6
+ x=x+(-1)^(i-1)*(z(x1,i))/((i-2)*h)
+ end
+endfunction
+h=1;
+z=[-3,-33;-2,-12;-1,-3;0,0;1,3;2,12;3,33];
+for i=3:6
+ for j=1:9-i
+ z(j,i)=z(j+1,i-1)-z(j,i-1)
+ end
+end
+printf('\n')
+for i=1:7
+ for j=1:6
+ if j==1
+ printf(' %g\t ',z(i,j))
+ else
+ printf('%i\t ',z(i,j))
+ end
+ end
+ printf('\n')
+end
+printf("\n\nf`(-3) = %g\n\nf`(0) = %g",f(1),f(4))
\ No newline at end of file |