# Revision history [back]

### Complex argument of a symbolic expression

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'


But:

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


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?

### Complex argument of a symbolic expression

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'


But:

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


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.