Completing the square and compact forms for human reading



On Wed, 12 Aug 2009, Richard Fateman wrote:

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

Thnaks Richard.  Interesting, although it throws up a little puzzle -
bothcoef() is supposed to call ratcoef() when its first argument is in
radcan()ed form, right?  Yet

bothcoef(radcan((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),n^4)
;

gives a different coefficient from

ratcoef(radcan((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),n^4)
;

> Unfortunately
>
> "tends to produce a form that's nice"
>
> is too vague

While what I said was indeed vague, the above selective quotation of
it is even vaguer ;-).  How about "optimized to produce a short file
when run through stringout()"?

-- 

Regards,

Dan