Complex.prototype.norm2

Returns the norm of the complex number, defined as the sum of the squares of the real and imaginary parts.

$$\lVert{z}\rVert^2 = \Re({z})^2+\Im({z})^2$$

Syntax

norm2()

Return value

A number.

Examples

Complex(3, 4).norm2()
25

See also