jonathanfishbein1/complex-numbers/1.0.0

NOTE: the latest version is 11.0.1

ComplexNumbers

A module for complex numbers

Types

type Real r
= Real r

Real portion

type Imaginary i
= Imaginary i

Imaginary portion

type Modulus m
= Modulus m

Modulus or magnitude portion

type Theta t
= Theta t

Angle in real-complex plane of modulus

= ComplexNumberCartesian (Real a) (Imaginary b)

Cartesian representation of a complex number

= ComplexNumberPolar (Modulus a) (Theta b)

Polar representation of a complex number

{-| Arithmetic operations on complex numbers -}

Add two complex numbers

add :
ComplexNumberCartesian number number
-> ComplexNumberCartesian number number
-> ComplexNumberCartesian number number

Add two complex numbers together

Monoidally add two complex numbers

sum : Monoid (ComplexNumberCartesian number number)

Monoidally add two complex numbers together

Multiply two complex numbers

ComplexNumberCartesian number number
-> ComplexNumberCartesian number number
-> ComplexNumberCartesian number number

Multiply two complex numbers together

Monoidally multiply two complex numbers

product : Monoid (ComplexNumberCartesian number number)

Monoidally multiply two complex numbers together

Subtract two complex numbers

ComplexNumberCartesian number number
-> ComplexNumberCartesian number number
-> ComplexNumberCartesian number number

Subtract two complex numbers together

Divide two complex numbers

-> ComplexNumberCartesian Float Float
-> Result String (ComplexNumberCartesian Float Float)

Divide two complex numbers together

Calculate modulus of a complex number

modulus : ComplexNumberCartesian Float Float -> Float

Calculate the modulus of a complex number

Calculate the conjugate of a complex number

Calculate the conjugate of a complex number

Convert from the Cartesian representation of a complex number to the polar representation

Convert from the Cartesian representation of a complex number to the polar representation

Convert from the polar representation of a complex number to the Cartesian representation

Convert from the polar representation of a complex number to the Cartesian representation