summaryrefslogtreecommitdiff
path: root/191/CH5/EX5.4
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /191/CH5/EX5.4
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 '191/CH5/EX5.4')
-rwxr-xr-x191/CH5/EX5.4/Example5_4.sce30
-rwxr-xr-x191/CH5/EX5.4/Result5_4.txt30
2 files changed, 60 insertions, 0 deletions
diff --git a/191/CH5/EX5.4/Example5_4.sce b/191/CH5/EX5.4/Example5_4.sce
new file mode 100755
index 000000000..7e4395265
--- /dev/null
+++ b/191/CH5/EX5.4/Example5_4.sce
@@ -0,0 +1,30 @@
+//Polynomial Interpolation: Divided Differnce form
+clc;
+clear;
+close();
+format('v',8);
+x = [1 1.5 1.75 2];
+fx = [0 0.40547 0.55962 0.69315];
+fab(1) = (fx(2)-fx(1))/(x(2)-x(1));
+fab(2) = (fx(3)-fx(2))/(x(3)-x(2));
+fab(3) = (fx(4)-fx(3))/(x(4)-x(3));
+fabc(1)= (fab(2)-fab(1))/(x(3)-x(1));
+fabc(2)= (fab(3)-fab(2))/(x(4)-x(2));
+fabcd(1)= (fabc(2)-fabc(1))/(x(4)-x(1));
+
+x(5)=1.1;
+fx(5)=0.09531;
+fab(4) = (fx(5)-fx(4))/(x(5)-x(4));
+fabc(3)= (fab(4)-fab(3))/(x(5)-x(3));
+fabcd(2)= (fabc(3)-fabc(2))/(x(5)-x(2));
+fabcde(1)=(fabcd(2)-fabcd(1))/(x(5)-x(1));
+disp(fabcde,fabcd,fabc,fab,fx','Divided difference columns : ')
+
+x1 = poly(0,'x1');
+p3x = fx(1)+fab(1)*(x1-x(1))+fabc(1)*(x1-x(1))*(x1-x(2))+fabcd(1)*(x1-x(1))*(x1-x(2))*(x1-x(3));
+p3=horner(p3x,1.3);
+disp(p3,'The interpolated value at 1.3 using p3(x) is : ')
+
+p4x = p3x + fabcde(1)*(x1-x(1))*(x1-x(2))*(x1-x(3))*(x1-x(4));
+p4=horner(p4x,1.3);
+disp(p4,'The interpolated value at 1.3 using p4(x) is : ')
diff --git a/191/CH5/EX5.4/Result5_4.txt b/191/CH5/EX5.4/Result5_4.txt
new file mode 100755
index 000000000..947dbb8f1
--- /dev/null
+++ b/191/CH5/EX5.4/Result5_4.txt
@@ -0,0 +1,30 @@
+
+ Divided difference columns :
+
+ 0.
+ 0.40547
+ 0.55962
+ 0.69315
+ 0.09531
+
+ 0.81094
+ 0.6166
+ 0.53412
+ 0.66427
+
+ - 0.25912
+ - 0.16496
+ - 0.20023
+
+ 0.09416
+ 0.08816
+
+ - 0.05996
+
+ The interpolated value at 1.3 using p3(x) is :
+
+ 0.26137
+
+ The interpolated value at 1.3 using p4(x) is :
+
+ 0.26250 \ No newline at end of file