# [Maxima] [newbie] problem with determining modulus of complex quantity

Leo Butler l_butler at users.sourceforge.net
Thu Nov 21 09:42:52 CST 2013

```>   Date: Thu, 21 Nov 2013 15:58:12 +0100
>   From: Hugo Coolens <hugo.coolens at kuleuven.be>
>
>   I defined the following function:
>   calpgon(m,s):=product(1/(s+4*(cos((k*%pi)/(2*m+1)))^2),k,1,m);
>
>   simplified it for the case m=3 like this:
>   trigrat(calpgon(3,s));
>					   1
>   (%o2)                         -------------------
>				   3      2
>				  s  + 5 s  + 6 s + 1
>
>
>   substituted s by i*omega like this
>
>   s : %i*omega;
>
>   tried to calculate the modulus of calpgon(3,i*omega) like this
>   abs(trigrat(calpgon(3,s)));
>
>   and got this:
>			!         3                     2    !
>			!%i (omega  - 6 omega) - 5 omega  + 1!
>   (%o4)               --------------------------------------
>			       6           4           2
>			  omega  + 13 omega  + 26 omega  + 1
>
>   however I hoped to get this "neater" form:
>					 1
>			 --------------------------------
>			 sqrt(omega^6+13 omega^4 +26 omega^2+1)
>
>   Can anyone here tell me how to make maxima go for the last expression?

(%i1) calpgon(m,s):=product(1/(s+4*(cos((k*%pi)/(2*m+1)))^2),k,1,m)\$

(%i2) trigrat(calpgon(3,%i*ω));
(%o2) (%i*(ω^3-6*ω)-5*ω^2+1)/(ω^6+13*ω^4+26*ω^2+1)

(%i3) ratsimp(cabs(%));
(%o3) 1/sqrt(ω^6+13*ω^4+26*ω^2+1)

Leo
```