summaryrefslogtreecommitdiff
path: root/964/CH6/EX6.8
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /964/CH6/EX6.8
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
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