summaryrefslogtreecommitdiff
path: root/1670/CH5/EX5.1
diff options
context:
space:
mode:
Diffstat (limited to '1670/CH5/EX5.1')
-rwxr-xr-x1670/CH5/EX5.1/5_1.sce28
1 files changed, 28 insertions, 0 deletions
diff --git a/1670/CH5/EX5.1/5_1.sce b/1670/CH5/EX5.1/5_1.sce
new file mode 100755
index 000000000..f56be633a
--- /dev/null
+++ b/1670/CH5/EX5.1/5_1.sce
@@ -0,0 +1,28 @@
+//Example 5.1
+//Backward Difference Formula
+//Page no. 124
+clc;close;clear;
+printf('\tx\t\ty\t1st Difference 2nd Difference 3rd Difference 4th Difference\n')
+printf('-------------------------------------------------------------------------------------------------')
+h=0.02;
+z=[-1;0;1;2;3;4;5]
+deff('y=f(x)','y=x^3-3*x^2+5*x-7')
+for i=1:7
+ z(i,2)=f(z(i,1))
+end
+for i=3:8
+ for j=1:9-i
+ z(j,i)=z(j+1,i-1)-z(j,i-1)
+ end
+end
+printf('\n')
+for i=1:7
+ for j=1:6
+ if z(i,j)==0 then
+ printf('\t%i\t',z(i,j))
+ else
+ printf('\t%i\t',z(i,j))
+ end
+ end
+ printf('\n')
+end \ No newline at end of file