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/CH5/EX5.21 | |
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/CH5/EX5.21')
-rwxr-xr-x | 1670/CH5/EX5.21/5_21.sce | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/1670/CH5/EX5.21/5_21.sce b/1670/CH5/EX5.21/5_21.sce new file mode 100755 index 000000000..56aab357f --- /dev/null +++ b/1670/CH5/EX5.21/5_21.sce @@ -0,0 +1,38 @@ +//Example 5.21
+//Newton's Forward Difference Formula
+//Page no. 145
+clc;close;clear;
+printf(' x\t f(x)\t\t 1st\t\t 2nd\t\t 3rd\t\t\n\t\t\tdifference\tdifference\tdifference\t')
+printf('\n---------------------------------------------------------------------------------------------------')
+h=1;
+z=[0,-4;1,-1;2,2;3,11;4,32;5,71]
+deff('y=f1(x,p)','y=z(x,2)+p*z(x,3)+p*(p-1)*z(x,4)/2+p*(p-1)*(p-2)*z(x,5)/6')
+x01=0;x11=6;
+x02=2;x12=2.5
+for i=3:7
+ for j=1:8-i
+ z(j,i)=z(j+1,i-1)-z(j,i-1)
+ end
+end
+printf('\n')
+for i=1:6
+ for j=1:5
+ if z(i,j)==0 & i~=1 then
+ printf(' \t')
+ else
+ if j==1 then
+ printf(' %.1f\t',z(i,j))
+ else
+ printf('%.7f\t',z(i,j))
+ end
+ end
+ end
+ printf('\n')
+end
+x=poly(0,'x')
+l=z(1,2)+x*z(1,3)+x*(x-1)*z(1,4)/2+x*(x-1)*(x-2)*z(1,5)/6
+disp(l,"The required equation is :")
+p=(x11-x01)/h;
+disp(f1(1,p),"fp (6) =");
+p=(x12-x02)/h;
+disp(f1(3,p),"fp (2.5) =");
|