I'm not sure if this function already exists, but I have the following
/* Write the polynomial in completed square form */
comp_square(ex,var) := block([vc],
if not(atom(var)) or numberp(var) then (print("comp_square: var should be an atom but not a number. "),return(ex)),
ex:ratsimp(expand(ex)),
if not(polynomialp(ex,[var])) then (print("comp_square: ex should be a polynomial in var. "),return(ex)),
if hipow(ex,var)#2 then (print("comp_square: ex should be a quadratic. "),return(ex)),
vc:coeff(ex,var,1)/(2*coeff(ex,var,2)),
return(coeff(ex,var,2)*((var+vc)^2-subst(vc,var,ex)))
)$
Chris
On Mon, 24 Oct 2011, Juan Pablo Carbajal wrote:
> Hi all,
> It has been a long time.
>
> I was wondering what is the easies way to make Maxima complete the
> square and cube? I tried factor, but is not working.
>
> any ideas?
>
> Thanks
>
>
> --
> M. Sc. Juan Pablo Carbajal
> -----
> PhD Student
> University of Z?rich
> http://ailab.ifi.uzh.ch/carbajal/
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>