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