summaryrefslogtreecommitdiff
path: root/964/CH18/EX18.1/18_1.sce
diff options
context:
space:
mode:
Diffstat (limited to '964/CH18/EX18.1/18_1.sce')
-rwxr-xr-x964/CH18/EX18.1/18_1.sce18
1 files changed, 18 insertions, 0 deletions
diff --git a/964/CH18/EX18.1/18_1.sce b/964/CH18/EX18.1/18_1.sce
new file mode 100755
index 000000000..d59260cd3
--- /dev/null
+++ b/964/CH18/EX18.1/18_1.sce
@@ -0,0 +1,18 @@
+//clc()
+//f1(x) = f0(x) +(f(x1) - f(x0) *(x - x0)/ (x1 - x0)
+x = 2;
+x0 = 1;
+x1 = 6;
+m = 1.791759;
+n = 0;
+r = log(2);
+f = 0 + (m - n) * (x - x0) / (x1 - x0);
+disp(f,"value of ln2 for interpolation region 1 to 6 =")
+e = (r - f) * 100/r;
+disp("%",e,"error by interpolation for interval[1,6] =")
+x2 = 4;
+p = 1.386294;
+f = 0 + (p - n) * (x - x0) / (x2 - x0);
+disp(f,"value of ln2 for interpolation region 1 to 6 =")
+e = (r - f) * 100/r;
+disp("%",e,"error by interpolation for interval[1,6] =")