Stavros Macrakis wrote:
> ....
> And of course many useful transformations will not be found anyway.
> For instance, I don't know of any practical way to perform
> "simplifications" like x^5-14*x^4+94*x^3-264*x^2+409*x-242 =>
> (x+1)^4+(x-3)^5.
>
some of these can be found if you really care. I named this program
"bleed" in honor of the
recent rash of vampire books and movies. It tries to drain the blood
out of a polynomial of
degree N by reducing it to a power of (x +c)^N + a polynomial of
degree N-2 or less.
recursively, it will skip about half or more of the terms, guaranteed.
Other versions of this, hypothesizing other reductions, could be written
along the same lines.
/* maxima program to try to reduce a polynomial of degree n to a sum of
about n/2 powers */
bleed(p,x):=
(p:rat(p,x),
block([a,h,leadterm],
h:hipow(p,x),
if p=0 then return(0),
if h=0 then return(ratdisrep(p)),
a:ratdisrep(ratcoef(p,x,h)), /*leading coefficient is a*/
if a#1 then return (multthru(a,bleed(p/a,x))),
leadterm: ratsimp(x+ratcoef(p,x,h-1)/h)^h, /* this is
x^h+c*x^(h-1)+ ... */
leadterm + multthru(a, bleed(p-leadterm,x))))$
/*try bleed((x+1)^4 +(x-3)^5,x) loses somewhat
bleed((x+1)^7+(x-4)^2, x) wins
bleed((a*x+b)^7 +(c*x^2+d*x+e)^2, x) ehh, we have wrong
hypothesis. not terrible though.
*/