John Cagnol


Paris, France

Introduction au Calcul Scientifique
ESI CS 1402 - Printemps 2010

Dérivation numérique de sinus

> f:=x->sin(x);
proc (x) options operator, arrow; sin(x) end proc
> plot(f(x),x=0..7);
Plot_2d
> fprime:=proc(x)
local h;
h:=0.1;
return((f(x+h)-f(x))/h);
end;
proc (x) local h; `:=`(h, .1); return `/`(`*`(`+`(f(`+`(x, h)), `-`(f(x)))), `*`(h)) end proc
> plot({fprime(x),cos(x)},x=0..7);
Plot_2d