-
Notifications
You must be signed in to change notification settings - Fork 0
Algebra
###Namespace: RedMath
This class is meant to handle all of the common mathematical functions that one may need. It handles the simpler functions in mathematics e.g. Power, Root, Log, Floor, etc.
Returns b raised to the x power.
- double b : The base of the power
- double x : The power to raise b to
Algebra.Power(2, 3)
The result is 8
Returns the factorial of x.
- uint x : The value to get the factorial of
Algebra.Factorial(5)
The result is 120
Returns e raised to the x power.
- double x : The power to raise e to
Algebra.Exponent(5)
The result is 148.4131...
Returns e raised to the complex z power.
- double z : The complex power to raise e to
Algebra.Exponent(new Complex(2, 3))
The result is -7.315+1.043i
Returns e raised to the x power. Faster then calculating the real exponent - Meant to be used in highly optimised environments.
- int x : The integer power to raise e to
Algebra.IntExponent(5)
The result is 148.4131...
Returns the natural logarithem of x (ln(x)).
- double x : The value to solve the natural logarithem for
Algebra.NaturalLogarithem(Algebra.E)
The result is 1
Returns the sign of x :
- x > 0 Returns 1
- x < 0 Returns -1
- x = 0 Returns 0
- double x : The number to get it's sign
Algebra.Sign(-7)
The result is -1
Returns the larger number of the two.
- double a : The first number to compare
- double b : The second number to compare
Algebra.Max(-3, 8)
The result is 8
Returns the smaller number of the two.
- double a : The first number to compare
- double b : The second number to compare
Algebra.Min(-3, 8)
The result is -3
Returns the Arithmetic–Geometric Mean.
- double x : The first number to use for the computation
- double y : The second number to use for the computation
Algebra.AGM(10, 20)
The result is 14.4275
Returns the number rounded.
- double x : The number to round
Algebra.Round(3.2)
The result is 3
Returns the number rounded up.
- double x : The number to round
Algebra.Ceiling(3.2)
The result is 4
Returns the number rounded down.
- double x : The number to round
Algebra.Floor(3.2)
The result is 3
Returns the absolute value of the given number.
- double x : The number to get the absolute value of
Algebra.Absolute(-5)
The result is 5
Returns a boolean that determines if the given number is a power of two.
- ulong x : The number to test
Algebra.IsPowerOfTwo(8)
The result is 'true'
Returns the next greater power of two. If the x is already a power of two, returns x.
- int x : The number to get it's next greater power of two
Algebra.NextGreaterPowerOfTwo(29)
The result is 32
Returns the square root of a. Faster then NthRoot.
- double a : The number to get it's square root
Algebra.SquareRoot(16)
The result is 4
Returns the n-th root of a.
- double a : The number to get it's n-th root
- double n : The degree of the root
Algebra.NthRoot(27, 3)
The result is 3
Returns b to the n power
- double b : The number to raise to the n power
- double n : The power to raise b to
Algebra.IntPower(4, 3)
The result is 64
Returns b to the n power
- double b : The complex number to raise to the n power
- double n : The power to raise b to
Algebra.IntPower(new Complex(2, 3), 2)
The result is -5+12i