summaryrefslogtreecommitdiff
path: root/243/CH9/EX9.8
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /243/CH9/EX9.8
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 '243/CH9/EX9.8')
-rwxr-xr-x243/CH9/EX9.8/9_08.sce24
1 files changed, 24 insertions, 0 deletions
diff --git a/243/CH9/EX9.8/9_08.sce b/243/CH9/EX9.8/9_08.sce
new file mode 100755
index 000000000..58cc2f790
--- /dev/null
+++ b/243/CH9/EX9.8/9_08.sce
@@ -0,0 +1,24 @@
+//Example No. 9_08
+//Newton-Gregory forward difference formula
+//Pg No. 297
+clear ; close ; clc ;
+
+X = [ 10 20 30 40 50]
+Fx = [ 0.1736 0.3420 0.5000 0.6428 0.7660]
+x = poly(0,'x');
+A = [X' Fx'];
+for i = 3:6
+ A(1:7-i,i) = diff(A(1:8-i,i-1))
+end
+disp(A)
+x0 = X(1);
+h = X(2) - X(1) ;
+x1 = 25
+s = (x1 - x0)/h ;
+p(1) = Fx(1);
+for j = 1:4
+ p(j+1) = p(j) + prod(s*ones(1,j)-[0:j-1])*A(1,j+2)/factorial(j)
+end
+printf('p1(s) = %.4G \n p2(s) = %.4G \n p3(s) = %.4G \n p4(s) = %.4G \n',p(2),p(3),p(4),p(5))
+printf(' Thus sin(%d) = %.4G \n ',x1,p(5))
+