diff options
Diffstat (limited to '191/CH6/EX6.2/Example6_2.sce')
-rwxr-xr-x | 191/CH6/EX6.2/Example6_2.sce | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/191/CH6/EX6.2/Example6_2.sce b/191/CH6/EX6.2/Example6_2.sce index d4604caea..1779ff2e4 100755 --- a/191/CH6/EX6.2/Example6_2.sce +++ b/191/CH6/EX6.2/Example6_2.sce @@ -1,21 +1,21 @@ -//Numerical Differentiation
-clc;
-clear;
-close();
-format('v',9);
-deff('[y]=f(x)','y=exp(-x)');
-h = [1 .2 .1 .02 .01 .002 .001 .0002];
-x0 = 1 - h;
-x1 = ones(:,8);
-x2 = 1+h;
-f0 = f(x0);
-f1 = f(x1);
-f2 = f(x2);
-dif = (f2-f0)./(2*h);
-max_trun_err = exp(h-1).*h^2/6;
-act_err = abs(- exp(-1)-dif);
-answer = [h' f0' f2' dif' max_trun_err' act_err'];
-disp(answer,' h f0 f2 f2-f0/2h h^2*exp(h-1)/6 |Actual Error|');
-disp('truncation error does not exceed h^2*exp(h-1)/6')
-x = (0:.0002:3);
+//Numerical Differentiation +clc; +clear; +close(); +format('v',9); +deff('[y]=f(x)','y=exp(-x)'); +h = [1 .2 .1 .02 .01 .002 .001 .0002]; +x0 = 1 - h; +x1 = ones(1,8); +x2 = 1+h; +f0 = f(x0); +f1 = f(x1); +f2 = f(x2); +dif = (f2-f0)./(2*h); +max_trun_err = exp(h-1).*h.^2/6; +act_err = abs(- exp(-1)-dif); +answer = [h' f0' f2' dif' max_trun_err' act_err']; +disp(answer,' h f0 f2 f2-f0/2h h^2*exp(h-1)/6 |Actual Error|'); +disp('truncation error does not exceed h^2*exp(h-1)/6') +x = (0:.0002:3); plot(x,f(x));
\ No newline at end of file |