complex_num v1.0.2 ComplexNum.Polar

Summary

Functions

Returns a Complex Number with the same magnitude as this one, but with the imaginary part being 0

Retrieves the angle of the Complex number in Polar form

Divides a Complex Numbers in Polar form by another

Retrieves the magnitude of the Complex Number in Polar form

Computes the square of the magnitude of the Complex number in Polar Form

Multiplies two Complex Numbers in Polar form

Creates a new Complex Numbers in Polar Form from the given magnitude and angle, which can be written as: magnitude * e^{angle * i}

Integer exponentiation of a number in Polar form

Converts a Complex Number in Polar form to Cartesian form

Functions

abs(complex_num)

Returns a Complex Number with the same magnitude as this one, but with the imaginary part being 0.

angle(number)

Retrieves the angle of the Complex number in Polar form.

For r * e^{i * angle} this is angle.

This is a precise operation. (In stark contrast to computing the magnitude on a Complex Number in Cartesian form!)

div(complex_num1, complex_num2)

Divides a Complex Numbers in Polar form by another.

This is a precise and very fast operation: (r1 * e^{i * angle1}) / (r2 * e^{i * angle2}) = (r1 / r2) * e^{i * (angle1 - angle2)}

magnitude(number)

Retrieves the magnitude of the Complex Number in Polar form.

For r * e^(i * angle) this is r

This is a precise operation. (In stark contrast to computing the magnitude on a Complex Number in Cartesian form!)

magnitude_squared(complex_num)

Computes the square of the magnitude of the Complex number in Polar Form.

For r * e^(i * angle) this is

mult(complex_num1, complex_num2)

Multiplies two Complex Numbers in Polar form.

This is a precise and very fast operation: (r1 * e^{i * angle1}) * (r2 * e^{i * angle2}) = (r1 * r2) * e^{i * (angle1 + angle2)}

new(magnitude, angle \\ 0)

Creates a new Complex Numbers in Polar Form from the given magnitude and angle, which can be written as: magnitude * e^{angle * i}

pow(complex_num, exponent)

Integer exponentiation of a number in Polar form.

This is a precise and very fast operation: (r1 * e^{i * angle1}) ^ (r2 * e^{i * angle2}) = (r1^r2) * e^{i * (angle1 * angle2)}

to_cartesian(complex_num)

Converts a Complex Number in Polar form to Cartesian form.

This is a lossy operation, as cos and sin have to be used: