summaryrefslogtreecommitdiff
path: root/964/CH6/EX6.8
diff options
context:
space:
mode:
Diffstat (limited to '964/CH6/EX6.8')
-rwxr-xr-x964/CH6/EX6.8/6_8.sce20
1 files changed, 20 insertions, 0 deletions
diff --git a/964/CH6/EX6.8/6_8.sce b/964/CH6/EX6.8/6_8.sce
new file mode 100755
index 000000000..0f44bec04
--- /dev/null
+++ b/964/CH6/EX6.8/6_8.sce
@@ -0,0 +1,20 @@
+//clc()
+del = 0.01;
+z = 0.56714329
+x1 = 1;
+//f(x) = exp(-x) - x
+disp(x1,"x1 = ")
+for i = 1:4
+ if i == 1 then
+ x(i) = 1
+ else
+ w = x(i-1);
+ m = exp(-x(i-1)) - x(i-1);
+ x(i-1) = x(i-1)*(1+del);
+ n = exp(-x(i-1)) - x(i-1);
+ x(i) = w - (x(i-1)- w) * m/(n-m);
+ em = (z - x(i))*100/z;
+ disp(x(i),"x = ")
+ disp("%",em,"error = ")
+ end
+end