kill(all)$

appendix :maxima :fvm, second order ,finite differenc (central),version 1.0
peter.vlasschaert@gmail.com,20/10/2022

definition : central difference(approximation :second order differential)
-------------------------------------------------------------------------------------------

s1:f(x)=taylor(f(x), x, x0, 4);

with use : substution (=subst), we get truncate "taylor serie"

s1a:subst([x=x],s1);

s2:x-x0=Δx;

s2a:solve(s2,x)[1];

s2b:makelist(at(diff(f(x),x,i),x=x) =diff(f(x),x,i),i,0,4);

s3:subst([s2a],lhs(s1)) =subst([s2],rhs(s1));

s3a:subst([x0=x],s3);

s4:subst([Δx=-Δx],s3a);

→ central difference

s5:s3a+s4;

s6:limit(rhs(s5),Δx,0) = lhs(s5);

s6a:s5-lhs(s6);

use : s2b

s6b:subst(s2b,s6a);

s6b1:ratcoeff(rhs(s6b),'diff(f(x),x,2));

s6b2:lhs(s6b/s6b1)=expand(ratsimp(rhs(s6b/s6b1)));

s6b3:reverse(s6b2);

error : O(Δx^2)

s7:part(lhs(s6b3),1);

final : result second order (= central difference)

approximation :Δx → 0

s7a:'limit(lhs(s6b3),Δx,0) = rhs(s6b3);

definition : second order (= central difference)

s7b:ev(s7a,nouns);

-----------------------------------------------------------------------------------------------------