arg(x,y) = atan2(y,x)

function arg(complex(x,y)) = arg(x,y) = atan2(y,x)

The argument of a complex number complex(x,y) on the complex plane:

When a complex number is written in polar form

x + iy = r e

then its argument is the real value φ in the exponent. It is calculated numerically using the atan2 function.

This example deliberately replicates some of the arithmetic of complex numbers of Math to avoid importing that entire library for a couple lines of code. It also encodes the tiny amount of mathematical notation in HTML to void importing all of MathJax.

Complete code for this example:



 

Examples Page


Home | list | wiki | about | donate | index | forum | help | 中文 | translated from Chinese