blob: 8ddb401c6c662b95f67e604b77414a5e4b7f8881 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 :');
|