summaryrefslogtreecommitdiff
path: root/191/CH5/EX5.2/Example5_2.sce
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /191/CH5/EX5.2/Example5_2.sce
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 '191/CH5/EX5.2/Example5_2.sce')
-rwxr-xr-x191/CH5/EX5.2/Example5_2.sce26
1 files changed, 26 insertions, 0 deletions
diff --git a/191/CH5/EX5.2/Example5_2.sce b/191/CH5/EX5.2/Example5_2.sce
new file mode 100755
index 000000000..8ddb401c6
--- /dev/null
+++ b/191/CH5/EX5.2/Example5_2.sce
@@ -0,0 +1,26 @@
+//Theoritical bound on error
+//it needs Symbolic Toolbox
+//cd ~\Desktop\maxima_symbolic;
+//exec 'symbolic.sce'
+clc;
+clear;
+close();
+syms x;
+fx = log(x);
+n = 2;
+x0 = 2;
+x1 = 2.5;
+x2 = 3;
+diff1_fx = diff(fx,x);
+diff2_fx = diff(diff1_fx,x);
+diff3_fx = diff(diff2_fx,x);
+//so fx satisfies the continuity conditions on [2,3]
+x= poly(0,'x');
+eta = linspace(2,3,100);
+//fx-p2x is equal to
+func = (x-2)*(x-2.5)*(x-3)*2/(factorial(3)*eta^3);
+min_func = (x-2)*(x-2.5)*(x-3)*2/(factorial(3)*min(eta)^3);
+disp(min_func , 'func will be less than or equal to');
+x = 2.7;
+max_error = abs(horner(min_func,x));
+disp(max_error , 'Error does not exceed :'); \ No newline at end of file