Returns a complex number that is the ith root of unity of the specified degree.

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (Extreme.Numerics)

Syntax

Visual Basic (Declaration)
Public Shared Function RootOfUnity ( _
	degree As Integer, _
	index As Integer _
) As DoubleComplex
C#
public static DoubleComplex RootOfUnity (
	int degree,
	int index
)
C++
public:
static DoubleComplex RootOfUnity (
	int degree, 
	int index
)

Parameters

degree (System.Int32)
The degree of the root.
index (System.Int32)
The index of the root.

Return Value

A DoubleComplex that is the indexth root of unity of degree degree.

Remarks

The roots of unity are the solutions to the equation zn= 1, with n the degree, which cannot be zero. There are exactly n solutions to this equations. Together, they give the coordinates of a regular n-sided polygon with its center at the origin, its vertices at unit distance from the origin, and its first vertex on the real axis.

This method returns the roots of the specified degree in counter-clockwise order. The index can be any integer value.

Exceptions

ExceptionCondition
ArgumentOutOfRangeExceptiondegree is equal to zero.

See Also