implicit_taylor and implicit_derivative without solve
Subject: implicit_taylor and implicit_derivative without solve
From: Evgeniy Maevskiy
Date: Fri, 18 May 2012 14:56:38 +0300
One may compute Taylor's polynom for implicit function (and therefore
compute implicit_derivative) without solve equations.
F - an expression on x[1],x[2],... and y
a - list - the fixed point x
b - number - the fixed value y
F(a,b) must be 0
n - the degree of Taylor's polynom
my_implicit_taylor(F,a,b,n):=block(
[x:makelist(x[i],i,length(a)),dx:makelist(dx[i],i,length(a)),D,df],
if is(ev(F,x:a,y:b)#0) then
return("Unable to compute taylor polynom: F(a,b)#0"),
diff(F,y),
D:ev(%%,x:a,y:b),
if is(D=0) then
return("Unable to compute taylor polynom: D=0"),
F:taylor(ev(F,x:a+dx,y:b+dy),endcons(dy,dx),0,n),
df:0,
for k:1 thru n do df:df-1/D*expand(taylor(ev(F,dy:df),dx,0,k)),
expand(b+df)
)$
my_implicit_taylor(x[1]-log(y),[0],1,7);
For implicit vector-function:
F - list of expressions on x[1],... and y[1],...
a - list
b - list
my_implicit_taylor(F,a,b,n):=block(
[x:makelist(x[i],i,length(a)), y:makelist(y[i],i,length(b)),
dx:makelist(dx[i],i,length(a)), dy:makelist(dy[i],i,length(b)),D,df],
if is(length(F)#length(b)) then
return("Unable to compute taylor polynom: length(F)#length(b)"),
if is(ev(F,x:a,y:b)#makelist(0,length(b))) then
return("Unable to compute taylor polynom: F(a,b)#0"),
genmatrix(lambda([i,j],diff(F[i],y[j])),length(b),length(b)),
D:ev(%%,x:a,y:b),
if is(determinant(D)=0) then
return("Unable to compute taylor polynom: determinant(D)=0"),
F:taylor(ev(F,x:a+dx,y:b+dy),append(dx,dy),0,n),
df:makelist(0,length(b)),
for k:1 thru n do
df:df-transpose(
invert(D).map(expand, taylor(ev(F,dy:df),dx,0,k) )
)[1],
b+df
)$
my_implicit_taylor([x[1]-log(y[1]),x[2]-exp(y[2])],[0,1],[1,0],5);