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 /1673/CH3/EX3.18 | |
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 '1673/CH3/EX3.18')
-rwxr-xr-x | 1673/CH3/EX3.18/3_18.sce | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/1673/CH3/EX3.18/3_18.sce b/1673/CH3/EX3.18/3_18.sce new file mode 100755 index 000000000..4c185f6a3 --- /dev/null +++ b/1673/CH3/EX3.18/3_18.sce @@ -0,0 +1,23 @@ +//error in lagrange's interpolation formula
+//example 3.18
+//page 107
+clc;clear;close;
+x=[2 2.5 3.0];
+y=[0.69315 0.91629 1.09861];
+deff('y=l0(x)','y=(x-2.5)*(x-3.0)/(-0.5)*(-1.0)')
+x=poly(0,'x');
+disp(l0(x),'l0(x)=');
+deff('y=l1(x)','y=((x-2.0)*(x-3.0))/((0.5)*(-0.5))')
+x=poly(0,'x');
+disp(l1(x),'l1(x)=');
+deff('y=l2(x)','y=((x-2.0)*(x-2.5))/((1.0)*(0.5))')
+x=poly(0,'x');
+disp(l2(x),'l2(x)=');
+f_x=l0(2.7)*y(1)+l1(2.7)*y(2)+l2(2.7)*y(3);
+printf(' the calculated value is %f:',f_x);
+err=abs(f_x-log(2.7));
+deff('y=R_n(x)','y=(((x-2)*(x-2.5)*(x-3))/6)');
+est_err=abs(R_n(2.7)*(2/8))
+if est_err>err then
+ printf('\n\n the error agrees with the actual error')
+end
\ No newline at end of file |