summaryrefslogtreecommitdiff
path: root/1673/CH3/EX3.19/3_19.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /1673/CH3/EX3.19/3_19.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 '1673/CH3/EX3.19/3_19.sce')
-rwxr-xr-x1673/CH3/EX3.19/3_19.sce18
1 files changed, 18 insertions, 0 deletions
diff --git a/1673/CH3/EX3.19/3_19.sce b/1673/CH3/EX3.19/3_19.sce
new file mode 100755
index 000000000..bc7729d63
--- /dev/null
+++ b/1673/CH3/EX3.19/3_19.sce
@@ -0,0 +1,18 @@
+//error in lagrenge's interpolation
+//example 3.19
+//page 107
+clc;clear;close;
+x=[0 %pi/4 %pi/2];
+y=[0 0.70711 1.0];
+deff('y=l0(x)','y=((x-0)*(x-%pi/2))/((%pi/4)*(-%pi/4))')
+x=poly(0,'x');
+disp(l0(x),'l0(x)=');
+deff('y=l1(x)','y=((x-0)*(x-%pi/4))/((%pi/2)*(%pi/4))')
+x=poly(0,'x');
+disp(l1(x),'l1(x)=');
+f_x=l0(%pi/6)*y(2)+l1(%pi/6)*y(3);
+err=abs(f_x-sin(%pi/6));
+deff('y=f(x)','y=((x-0)*(x-%pi/4)*(x-%pi/2))/6');
+if abs(f(%pi/6))>err then
+ printf('\n\n the error agrees with the actual error')
+end \ No newline at end of file