From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 1670/CH5/EX5.22/5_22.sce | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 1670/CH5/EX5.22/5_22.sce (limited to '1670/CH5/EX5.22/5_22.sce') diff --git a/1670/CH5/EX5.22/5_22.sce b/1670/CH5/EX5.22/5_22.sce new file mode 100755 index 000000000..27c699e81 --- /dev/null +++ b/1670/CH5/EX5.22/5_22.sce @@ -0,0 +1,34 @@ +//Example 5.22 +//Newton's Forward Difference Formula +//Page no. 147 +clc;close;clear; +printf(' x\t y\t\t 1st\t\t 2nd\t\t 3rd\t\t\n\t\t\tdifference\tdifference\tdifference\t') +printf('\n---------------------------------------------------------------------------------------------------') +h=1; +z=[0,-3;1,3;2,11;3,27;4,57;5,107] +deff('y=f1(x,p)','y=z(x,2)+p*z(x,3)+p*(p-1)*z(x,4)/2+p*(p-1)*(p-2)*z(x,5)/6') +x01=0;x11=6; +x02=2;x12=2.5 +for i=3:7 + for j=1:8-i + z(j,i)=z(j+1,i-1)-z(j,i-1) + end +end +printf('\n') +for i=1:6 + for j=1:5 + if z(i,j)==0 & i~=1 then + printf(' \t') + else + if j==1 then + printf(' %.1f\t',z(i,j)) + else + printf('%.7f\t',z(i,j)) + end + end + end + printf('\n') +end +x=poly(0,'x') +l=z(1,2)+x*z(1,3)+x*(x-1)*z(1,4)/2+x*(x-1)*(x-2)*z(1,5)/6 +disp(l,"The required equation is :") \ No newline at end of file -- cgit