Click or drag to resize

ComplexMathSqr Method

Computes the square of a complex number.

Namespace:  Meta.Numerics
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax
public static Complex Sqr(
	Complex z
)

Parameters

z
Type: Meta.NumericsComplex
The argument.

Return Value

Type: Complex
The value of z2.
Remarks

Unlike Sqr(Double), there is slightly more to this method than shorthand for z * z. In terms of real and imaginary parts z = x + i y, the product z * z = (x * x - y * y) + i(x * y + x * y), which not only requires 6 flops to evaluate, but also computes the real part as an expression that can easily overflow or suffer from significant cancelation error. By instead computing z2 via as (x - y) * (x + y) + i 2 * x * y, this method not only requires fewer flops but is also less subject to overflow and cancelation error. You should therefore generally favor the computation of z2 using this method over its computation as z * z.

See Also