Completing the square and compact forms for human reading
Subject: Completing the square and compact forms for human reading
From: Richard Fateman
Date: Wed, 12 Aug 2009 10:25:12 -0700
I think there is a generalization (completing the nth power) that you
could look at. I don't know specifically about completing the square,
but it would not be hard to produce. Look at ratcoef, bothcoef. First
you need to make a list of variables in the expression, and their
highest powers..
Unfortunately
"tends to produce a form that's nice"
is too vague and attempts to make it more concrete tends to degenerate
into costly flailing and search except for very small expressions.
And you usually want to use it for large expressions.
So most people try a few things like factor, ratsimp, trigsimp.
RJf
Dan Hatton wrote:
> Dear All,
>
> Two closely-related questions
>
> - Is there a Maxima function for completing the square in a polynomial
> expression?
> - Generally, is there a simplifier function that tends to produce a
> form that's nice and compact for a human to read?
>
> What's motivating this is that I have a bunch of expressions whose
> radcan()ed forms are like
>
> -(((9*%pi*l^2*n*theta10*w22-18*%pi*l^2*n*theta22*w10)*R0*X^2+(18*%pi*l^3*theta22*u10-9*%pi*l^3*theta10*u22)*R0*X)*Y^4+((%pi*m^2*n*theta10*w22-2*%pi*m^2*n*theta22*w10)*R0*X^4+(2*%pi*l*m^2*theta22*u10-%pi*l*m^2*theta10*u22)*R0*X^3)*Y^2)/((4*%pi^2*n^4*X^4+(72*%pi^2*l^2*n^2-36*l^2*R0)*X^2+324*%pi^2*l^4)*Y^4+((8*%pi^2*m^2*n^2-4*m^2*R0)*X^4+72*%pi^2*l^2*m^2*X^2)*Y^2+4*%pi^2*m^4*X^4)
>
> and I'd like to automate the process of writing them more like
>
> %pi*X*Y^2*R0*((((3*Y*l)^2+(X*m)^2)*l*u22-X*((3*Y*l)^2+(X*m)^2)*n*w22)*theta10-2*((9*Y^2*l^2+X^2*m^2)*l*u10-X*(9*Y^2*l^2+X^2*m^2)*n*w10)*theta22)/(4*(%pi^2*((3*Y*l)^2+(X*m)^2+(X*Y*n)^2)^2-((3*Y*l)^2+(X*m)^2)*(X*Y)^2*R0))
>
>