angle

angle(z)

Compute the phase angle in radians of a complex number z

Examples

julia> angle(2 + 2im)
0.7853981633974483

This example calculates the phase angle in radians of the complex number 2 + 2im.

julia> angle(-1 + im)
2.356194490192345

Here, the angle function is used to find the phase angle of the complex number -1 + im in radians.

julia> angle(0 + 1im)
1.5707963267948966

The angle function can also be used with pure imaginary numbers. This example returns the phase angle of 0 + 1im in radians.

Common mistake example:

julia> angle(0)
DomainError with 0.0:
angle will only return NaN for complex numbers with zero imaginary part.

In this example, the angle function is used with a real number 0. The function expects a complex number, so passing a real number will result in a DomainError.

See Also

all, all!, angle, any, any!, falses, ifelse, is, isinf, isinteger, isnan, isperm, ispow2, isreal, trues,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: