Maple

Hi,

Would anyone know how to customize the CompleteSquare function. Reason is I am trying to extend it to complex numbers. Examples below. (Unfortunately the text editor is playing up but if you could copy and paste the text below in your Maple you should be able to see it more clearly).

eqn1 := x__1^2+4*x__1*x__2+2*x__2^2;

with(Student[Precalculus]):

CompleteSquare(eqn1, [x__1, x__2]);

This gives the answer below which is correct.

2*(x__2+x__1)^2-x__1^2

However consider the complex function below:

x__1*conjugate(x__1)-conjugate(x__1)*x__2+3*conjugate(x__1)*x__3-conjugate(x__2)*x__1+2*x__2*conjugate(x__2)+3*conjugate(x__3)*x__1+14*x__3*conjugate(x__3)

I am trying to factorize this into the following:

(x__1-x__2+3*x__3)*(conjugate(x__1)-conjugate(x__2)+3*conjugate(x__3))+(x__2+3*x__3)*(conjugate(x__2)+3*conjugate(x__3))-4*x__3*conjugate(x__3)

The technique I am trying is to first try to come up with a generalized form of the CompleteSquare function and then try to extend it to complex factorization but so far haven't been successful.