kill(all)$
load(lrats)$

taylor expansion 2D ,version 1.0a,other method
peter.vlasschaert @gmail.com,04/07/2018

p1:taylor(f(x,y), [x,y] ,[m1,m2],2);

p2:[x-m1=Δx,y-m2=Δy,m1=x,m2=y];
p3:lratsubst(p2,p1);

p4:expand(p3);

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

depends(u,[x,y]);

binomial coef

p5:n!/(i!*(n-i)!);

p6:1/n!*sum(p5*diff(u,x,n-i,y,i)*(Δx)^(n-i)*(Δy)^i,i,0,n);

p7:M(n,Δx,Δy):=''p6;

p7a:M(0,Δx,Δy);
p7b:M(1,Δx,Δy);
p7c:M(2,Δx,Δy);

p7a1:ev(p7a,nouns);
p7b1:ev(p7b,nouns);
p7c1:ev(p7c,nouns);

finite serie: evaluation function  , exp(0.02*0.02)

p8:u(x+Δx,y+Δy) =p7c1+p7b1+p7a1;

into rhs =>      u => u(x,y)

p9:lhs(p8)=lratsubst([u=u(x,y)],rhs(p8));

rem :  same above 'p4' except rhs :f(x,y) = u(x,y)

p10:expand(p9);

to find approximation function for small values
x=0
y=0
Δx=Δy=0.02

exact     value:  exp(0.02*0.02)

p10a:exp(0.02*0.02);

approximation ? six terms of taylor serie.

p10b1:lratsubst([u(x,y)=exp(x*y)],rhs(p10));
p10b2:[Δx=0.02,Δy=0.02,x=0,y=0];
p10b3:ev(p10b1,diff);
p10b4:lratsubst(p10b2,lhs(p10));

p10b5:p10b4=float(lratsubst(p10b2,p10b3));

example :  u = exp
rem :very good approximation for small values around (x,y)=(0,0)

approximation , number of terms

m:2;

same above : 'p10' we want to get.

s:0$
for n:0 thru m do
    (s:s+M(n,Δx,Δy));

p11:lhs(p8)=s;

p12:ev(p11,nouns);

p13:lhs(p12)=lratsubst([u=u(x,y)],rhs(p12));

we get same result  'p10' , futher  see 'above' for the approximation.

p14:expand(p13);