# [Maxima] simplify

Richard Fateman fateman at cs.berkeley.edu
Fri Sep 11 18:56:21 CDT 2009

```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

bleed(p,x):=
(p:rat(p,x),
h:hipow(p,x),
if p=0 then return(0),
if h=0 then return(ratdisrep(p)),
if a#1 then return (multthru(a,bleed(p/a,x))),
x^h+c*x^(h-1)+ ... */