summaryrefslogtreecommitdiff
path: root/1670/CH5/EX5.32/5_32.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1670/CH5/EX5.32/5_32.sce
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/CH5/EX5.32/5_32.sce')
-rwxr-xr-x1670/CH5/EX5.32/5_32.sce23
1 files changed, 23 insertions, 0 deletions
diff --git a/1670/CH5/EX5.32/5_32.sce b/1670/CH5/EX5.32/5_32.sce
new file mode 100755
index 000000000..dd2d6d5d1
--- /dev/null
+++ b/1670/CH5/EX5.32/5_32.sce
@@ -0,0 +1,23 @@
+//Example 5.32
+//Divided Difference Interpolation
+//Page no. 170
+clc;close;clear;
+
+x=[0,1,2,4]
+y=[1,3,9,81];
+y1=y;
+deff('yi=P(a,b,d,e)','yi=(b(d+1)-b(d))/(a(d+e)-a(d))') //function for finding polynomials
+for i=1:4
+ for j=1:4-i
+ z(j,i)=P(x,y,j,i)
+ y(j)=z(j,i)
+ end
+end
+z(6,1)=0;
+printf('x\ty f(x0,x1) f(x0,x1,x3) f(x0,x1,x2,x3)\n')
+printf('-----------------------------------------------------------\n')
+ for j=1:3
+ printf(' %i\t%i \t%i\t\t%i\t\t%i\t\t\n',x(1,j),y1(1,j),z(j,1),z(j,2),z(j,3))
+ end
+ deff('y=f(x1)','y=y1(1)+(x1-x(1))*z(1,1)+(x1-x(1))*(x1-x(2))*z(1,2)+(x1-x(1))*(x1-x(2))*(x1-x(3))*z(1,3)')
+ printf('\n\nf(3) = %g',f(3)) \ No newline at end of file