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, which returns 0 if z=0 . Csgn returns 1 if Re(z) >0 or if Re(z)=0 and Im(z)>0. Otherwise csgn returns -1.
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.