Solving "identification" problems




On Sun, 8 Nov 2009, Leo Butler wrote:

< 
< 
< On Sun, 8 Nov 2009, Ulf Ekstr?m wrote:
< 
< < Dear all,
< < I am trying to make Maxima identify terms for me, for example
< < 
< < solve(x*y=a*(x+y)^2+b*(x-y)^2,[a,b]);
< < 
< < which I would like to give me a=1/4, b=-1/4. However, it seems that solve()
< < is not really made for this kind of equations[1]. Is there any other function
< < I can use for these problems?
< < 
< < Sincerely,
< < Ulf Ekstr?m, VU University Amsterdam
< < 
< < [1] I get: [[a=-(%r3*y^2+(-2*%r3-1)*x*y+%r3*x^2)/(y^2+2*x*y+x^2),b=%r3]]
<  
< Ulf,
< The output from solve is correct, but you are looking for a & b as
< coefficients. Here are a couple ways to do this:
< 
< eq : x*y = a*(x+y)^2+b*(x-y)^2;
< define(eqab(x,y),eq);
< solve([eqab(1,1),eqab(3,0)],[a,b]);
< 
< ----
< 
< eq : rat(x*y - a*(y+x)^2+b*(x-y)^2);

Should be:
eq : rat(x*y - a*(y+x)^2-b*(x-y)^2);
for your example.

< map(lambda([t],ratcoef(eq,t)),[x*y,x^2,y^2]);
< linsolve(%,[a,b]);
< 
< Leo
< 
< -- 
< The University of Edinburgh is a charitable body, registered in
< Scotland, with registration number SC005336.
< 
< _______________________________________________
< Maxima mailing list
< Maxima at math.utexas.edu
< http://www.math.utexas.edu/mailman/listinfo/maxima
< 
< 
-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.