Jim Schott writes:
> I have a rather lengthy function of several variables that I know simplifies
> into a particular form. An over-simplified version of the problem goes like
> this. Suppose I know a function of x and y simplifies into the form
>
> a*(x + y)^2 + b*(x^2 + y^2)
>
> where a and b are constants. If maxima has the function in the form
>
> 2*(x^2 + y^2 + x*y)
>
> how can I get it to give me it in the desired form? That is, how do I
> get maxima to tell me that a=1 and b=1?
Would something like this be general enough for your original problem?
If so try `demo("facexp");' and `demo("stopex");' and perhaps read
share/simplification/facexp.usg and share/simplification/stopex.usg.
(c1) facsum(a*(x + y)^2 + b*(x^2 + y^2)-2*(x^2 + y^2 + x*y),x,y);
Warning - you are redefining the Macsyma function intersection
2 2
(d1) (b + a - 2) y + 2 (a - 1) x y + (b + a - 2) x
(c2) substinpart("[",%,0);
2 2
(d2) [(b + a - 2) x , 2 (a - 1) x y, (b + a - 2) y ]
(c3) subst([x=1,y=1],%);
(d3) [b + a - 2, 2 (a - 1), b + a - 2]
(c4) solve(%,[a,b]);
Dependent equations eliminated: (3)
(d4) [[a = 1, b = 1]]
Wolfgang