Expand an expression in Maple contening modulus

302 views Asked by At

I want to develop an expression such as |a+b+c|^2 . I tried the command " expand " but it does not work. ( it works without the modulus )

1

There are 1 answers

1
zhk On BEST ANSWER

The issue is that expand is unable to recognize whether a, b and c are positive or negative. So, you make that clear then expand will work the way it should.

restart:
A:=abs(a+b+c)^2;
assume(a>0,b>0,c>0):expand(A);

a^2+2*a*b+2*a*c+b^2+2*b*c+c^2

if

assume(a>0,b>0,c<0):

then use

expand(simplify(A))

Now, lets take three complex numbers and then take its modulus square,

B:=abs((a1+b1*I)+(a2+b2*I)+(a3+b3*I))^2;

Once again the same issue as above.

assume(a1>0,b1<0,a2>0,b2<0,a3<0,b3>0):expand(simplify(B));

a1^2+2*a1*a2+2*a1*a3+a2^2+2*a2*a3+a3^2+b1^2+2*b1*b2+2*b1*b3+b2^2+2*b2*b3+b3^2

Finally, assign some random values for a's and b's and find modulus,

subs(a1=1,a2=1,a3=1,b1=1,b2=2,b3=3,B);