summaryrefslogtreecommitdiff
path: root/75/CH3/EX3.8/ex_8.sce
diff options
context:
space:
mode:
Diffstat (limited to '75/CH3/EX3.8/ex_8.sce')
-rwxr-xr-x75/CH3/EX3.8/ex_8.sce50
1 files changed, 50 insertions, 0 deletions
diff --git a/75/CH3/EX3.8/ex_8.sce b/75/CH3/EX3.8/ex_8.sce
new file mode 100755
index 000000000..fcf4c5ed3
--- /dev/null
+++ b/75/CH3/EX3.8/ex_8.sce
@@ -0,0 +1,50 @@
+ // PG (150)
+
+X = [2.0,2.1,2.2,2.3,2.4]
+X1 = X(1,1)
+X2 = X(1,2)
+X3 = X(1,3)
+X4 = X(1,4)
+X5 = X(1,5)
+deff('[y]=f(x)','y=sqrt(x)')
+Y = [f(X1) f(X2) f(X3) f(X4) f(X5)]
+Y1 = Y(1,1)
+Y2 = Y(1,2)
+Y3 = Y(1,3)
+Y4 = Y(1,4)
+Y5 = Y(1,5)
+
+// Difference
+
+// f[X1,X2]
+(f(X2) - f(X1))
+// f[X2,X3]
+(f(X3) - f(X2))
+// f[X3,X4]
+(f(X4) - f(X3))
+// f[X4,X5]
+(f(X5) - f(X4))
+
+// D^2 * f[Xi]
+
+((f(X3)-f(X2)) - (f(X2)-f(X1)))
+((f(X4)-f(X3)) - (f(X3)-f(X2)))
+((f(X5)-f(X4)) - (f(X4)-f(X3)))
+
+// D^3 * f[Xi]
+
+((f(X4)-f(X3)) - (f(X3)-f(X2))) - ((f(X3)-f(X2)) - (f(X2)-f(X1)))
+((f(X5)-f(X4)) - (f(X4)-f(X3))) - ((f(X4)-f(X3)) - (f(X3)-f(X2)))
+
+// D^4 * f[Xi]
+
+(((f(X5)-f(X4)) - (f(X4)-f(X3))) - ((f(X4)-f(X3)) - (f(X3)-f(X2)))) - (((f(X4)-f(X3)) - (f(X3)-f(X2))) - ((f(X3)-f(X2)) - (f(X2)-f(X1))))
+
+mu = 1.5;
+x = 2.15;
+
+p1 = f(X1) + mu * (f(X2) - f(X1))
+p2 = p1 + mu*(mu-1)*((f(X3)-f(X2)) - (f(X2)-f(X1)))/2
+
+// Similarly, p3 = 1.466288
+// p4 = 1.466288 \ No newline at end of file