Ask Your Question

Complex argument of a symbolic expression

asked 2011-11-15 06:06:02 -0500

Juanlu001 gravatar image

updated 2011-11-15 06:09:17 -0500

I was wondering how could I get the argument of an expression involving complex numbers. For example, this simple case fails at first:

sage: z = i + 1.0
sage: z.argument() 

Traceback (most recent call last):
AttributeError: 'sage.symbolic.expression.Expression' object has no attribute 'argument'


sage: i = CC.0
sage: z = i + 1.0
sage: z.argument() * 180 / pi.n()

As you can see in this worksheet.

Of course, if the expression involves symbolic variables and such the same problem appears. Is there any direct way I can calculate the complex argument of a symbolic expression?

I mean, apart from

atan(z.imag() / z.real())

of course.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2011-11-15 06:54:02 -0500

parzan gravatar image

You can do this:

sage: z = i + 1.0
sage: arg(z)
edit flag offensive delete link more


Hm, works in this case, but it seems I still have problems with plot(), for example. Thank you anyway!

Juanlu001 gravatar imageJuanlu001 ( 2011-12-05 10:25:00 -0500 )edit

Is there any way of doing the original thing Juanlu asked - eg if I write z=exp(2*pi*i/17) then I would like to get z.arg() = 2*pi/17, not some horrid numerical approximation!!

GaryMak gravatar imageGaryMak ( 2013-04-23 08:16:58 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-11-15 06:06:02 -0500

Seen: 613 times

Last updated: Nov 15 '11