Example: Using Complex Number Functions
1. Define a complex number.
2. Use
Re and
Im functions to get the real part and the imaginary part of
z.
3. Use the
arg function to get the principal argument of
z, between −π and π.
4. Use the
csgn function to get the sign of the following complex numbers.
5. Use the
signum function to get the sign of a complex number.
6. Compare the signum function with the result of the following expression.
The above expression is how signum is calculated when z is not zero.
7. Use signum with 0 as the first argument.
The function returns the second argument, when z=0.