A collection of mathematical methods and algorithms - complex numbers, matrices, System.Math extension methods (including for the decimal type).
$ dotnet add package Wyrm.MathA collection of mathematical methods and algorithms.
Provides double and decimal extensions.
Decimal constants E, Pi, and Tau.
Applies all the System.Math methods as extension methods and adds Sqr (square).
Replicates the System.Math methods for decimals as extension methods. Abs, Acos, Acosh, Asin, Asinh, Atan, Atanh, Atan2, BitDecrement, BitIncrement, Cbrt, Ceiling, CopySign, Clamp, Cos, Cosh, Exp, Floor, FusedMultiplyAdd, IEEERemainder, ILogB, Log, Log (to base), Log2, Log10, Max, MaxMagnitude, Min, MinMagnitude, Pow, ReciprocalEstimate, ReciprocalSqrtEstimate, Round, Round (to digits), Round (with algorithm), Round (to digits with algorithm), ScaleB, Sign, Sin, SinCos, Sinh, Sqr, Sqrt, Tan, Tanh, Truncate.
Z = N.AsComplex()
Z = N.AsComplex(Ni)
Creates a double or decimal complex number from a value with an optional imaginary part.
Z = N.Cbrti()
Calculates the cube root of a number (either decimal or double) and returns the result as a complex number.
Z = N.Logi()
Calculates the principal natural logarithm of a number (either decimal or double) and returns the result as a complex number.
Z = N.Sqrti()
Calculates the square root of a number (either decimal or double) and returns the result as a complex number.
Provides complex number arithmetic.
This class allows complex numbers with double values to be created, added, subtracted, multiplied, and divided.
This class allows complex numbers with decimal values to be created, added, subtracted, multiplied, and divided.
You can cast a complex number with no imaginary part to a scalar and cast a scalar to a complex number.
Z' = Z.ComplexConjugate()
Calculates the complex conjugate of the complex number.
|Z| = Z.Abs()
Calculates the absolute value of the complex number.
P = Z.Argument()
Calculates the argument (or phase) of the complex number.
1/Z = Z.Inverse()
Calculates the inverse of the complex number.
Zv = Z + n
Zv = n + Z
Adds a scalar value to the complex number, creating a new complex number.
Zv = Z1 + Z2
Adds one complex number to another, creating a new complex number.
Z = + Z
Duplicates a complex number.
Zv = Z - n
Zv = n - Z
Subtracts a scalar value from a complex number or subtracts a complex number from a scalar, creating a new complex number.
Zv = Z1 - Z2
Subtracts one complex number from another, creating a new complex number.
Zv = - Z
Negates the complex number, creating a new complex number.
Zv = Z * n
Zv = n * Z
Multiplies a scalar value with a complex number, creating a new complex number.
Zv = Z1 * Z2
Multiplies one complex number with another, creating a new complex number.
Zv = Z / n
Zv = n / Z
Divides a scalar value into a complex number or divides a complex number into a scalar, creating a new complex number.
Zv = Z / Zd
Divides complex numbers, creating a new complex number.
Z^2 = Z.Sqr()
Z^0.5 = Z.Sqrt()
Z^n = Z.Pow(n)
Z^z = Z.Pow(z)
Raises a complex number by a power either real or complex.
Zv = Z.Sin()
Returns the sine of a complex number (radians).
Zv = Z.Cos()
Returns the cosine of a complex number (radians).
Zv = Z.Tan()
Returns the tangent of a complex number (radians).
Zv = Z.Asin()
Returns the complex angle (radians) that has the sine.
Zv = Z.Acos()
Returns the complex angle (radians) that has the cosine.
Zv = Z.Atan()
Returns the complex angle (radians) that has the tangent.
Zv = Z.Sinh()
Returns the hyperbolic sine of a complex number (radians).
Zv = Z.Cosh()
Returns the hyperbolic cosine of a complex number (radians).
Zv = Z.Tanh()
Returns the hyperbolic tangent of a complex number (radians).
Zv = Z.Asinh()
Returns the principal complex angle (radians) that the complex number is a hyperbolic sine of.
Zv = Z.Acosh()
Returns the principal complex angle (radians) that the complex number is a hyperbolic cosine of.
Zv = Z.Atanh()
Returns the principal complex angle (radians) that the complex number is a hyperbolic tangent of.
Zv = Z.Cbrt()
Returns the complex cube root of a complex number.
Zv = Zx.CopySign(Zy)
Returns a complex number with the magnitudes of Zx but the signs of Zy. The real part has the magnitude of Zx.Real but the sign of Zy.Real and the imaginary part has the magnitude of Zx.Imaginary but the sign of Zy.Imaginary.
Zv = Z.ScaleB(N)
Returns the result of Zx * 2^N as a complex number.
Zv = Z.Exp()
Returns the value of e to the power of a complex number.
Zv = Z.Log()
Returns the principal natural logarithm of a complex number.
Zv = Z.Log(b)
Returns the principal logarithm of a complex number in base b.
Zv = Z.Log(Zb)
Returns the principal logarithm of a complex number in complex base Zb.
Zv = Z.Log2()
Returns the principal logarithm of a complex number in base 2.
Zv = Z.Log10()
Returns the principal logarithm of a complex number in base 10.
Zr = Z.Round()
Zr = Z.Round(N)
Zr = Z.Round(MidPointRounding)
Zr = Z.Round(N, MidPointRounding)
Returns a complex number with the real and imaginary parts rounded.
Provides matrix arithmetic.
This class allows matrices with double values to be created, added, subtracted, and multiplied.
This class allows matrices with decimal values to be created, added, subtracted, and multiplied.
{M}' = {M}.Transpose()
Swaps the values of the matrix around the diagonal, creating a new matrix.
V = {M}.Trace()
Calculates the trace of a matrix.
The matrix must be square.
|{M}| = {M}.Determinant()
Calculates the determinant of a matrix using Gaussian Elimination.
The matrix must be square.
V = {M}.Rank()
Calculates the rank of a matrix using Gaussian Elimination.
V = {M}.Nullity()
Calculates the nullity of a matrix using Gaussian Elimination.
This is the number of columns minus the rank.
{M}^-1 = {M}.Inverse()
Calculates the inverse of a matrix using Gaussian Elimination.
The matrix must be square and invertible (non-zero determinant).
{Mv} = {M} + n
{Mv} = n + {M}
Adds a scalar value to every element in a matrix, creating a new matrix.
{Mv} = {M1} + {M2}
Adds one matrix to another, creating a new matrix.
The matrices must be of the same dimensions.
{M} = + {M}
Duplicates a matrix.
{Mv} = {M} - n
{Mv} = n - {M}
Subtracts a scalar value from every element in a matrix or subtracts each value in a matrix from a scalar, creating a new matrix.
{Mv} = {M1} - {M2}
Subtracts one matrix from another, creating a new matrix.
The matrices must be of the same dimensions.
{Mv} = - {M}
Negates every value in a matrix, creating a new matrix.
{Mv} = {M} * n
{Mv} = n * {M}
Multiplies a scalar value with every element in a matrix, creating a new matrix.
{Mv} = {M1} * {M2}
Multiplies one matrix with another using the naive algorithm, creating a new matrix.
The number of columns of the first matrix must be the same as the number of rows of the second matrix.
{Mv} = {M} / n
{Mv} = n / {M}
Divides a scalar value into every element in a matrix or divides each value in a matrix into a scalar, creating a new matrix.
M = [[],...].AsMatrix()
Creates a matrix from an enumerable of enumerable decimal or double values.