IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Defines some mathematical functions to be used in derived and other classes. * Standard mathematical functions and constants with short names are implemented, e.g. sin() instesd of Math.Sin().** These functions are public and static such that they can be used out of the derived classes, too.*** In particular, some script classes derive from this one, in order to use simple-named mathematical functions.** Some functions are defined with several names, in order to reduce probability of errors in scripts. More...
Static Public Member Functions | |
static void | Swap (ref double a, ref double b) |
Swaps values of the two specified variables of type double. | |
static void | Swap (ref int a, ref int b) |
Swaps values of the two specified variables of type int. | |
static void | Swap (ref string a, ref string b) |
Swaps values of the two specified variables of type string. | |
static double | abs (double a) |
Absolute value. | |
static double | sign (double a) |
Returns a value indicating the sign of a number. | |
static double | ceil (double a) |
Returns the smallest integral value that is greater than or equal to the specified decimal number. | |
static double | floor (double a) |
Returns the largest integer less than or equal to the specified number. | |
static double | trunc (double a) |
Calculates the integral part of a specified number. | |
static double | min (double a, double b) |
Smallest of two numbers. | |
static double | max (double a, double b) |
Largest of two numbers. | |
static double | min (double a, double b, double c) |
Smallest of three numbers. | |
static double | max (double a, double b, double c) |
Largest of three numbers. | |
static double | min (double a, double b, double c, double d) |
Smallest of four numbers. | |
static double | max (double a, double b, double c, double d) |
Largest of four numbers. | |
static double | min (double a, double b, double c, double d, double e) |
Smallest of five numbers. | |
static double | max (double a, double b, double c, double d, double e) |
Largest of five numbers. | |
static double | min (double a, double b, double c, double d, double e, double f) |
Smallest of six numbers. | |
static double | max (double a, double b, double c, double d, double e, double f) |
Largest of six numbers. | |
static double | min (params double[] numbers) |
Minimal of the specified values. | |
static double | max (params double[] numbers) |
Maximal of the specified values. | |
static double | sum (params double[] numbers) |
Sum of the specified values. | |
static double | prod (params double[] numbers) |
Product of the specified values. | |
static double | pow (double a, double b) |
Returns a specified number raised to the specified power. | |
static double | sqr (double a) |
Returns the square of a specified number. | |
static double | cube (double a) |
Returns the square of a specified number. | |
static double | pow2 (double x) |
Square. | |
static double | pow3 (double x) |
3rd power. | |
static double | pow4 (double x) |
4th power. | |
static double | pow5 (double x) |
5th power. | |
static double | pow6 (double x) |
6th power. | |
static double | sqrt (double a) |
Returns the square root of a specified number. | |
static double | root2 (double a) |
Returns the square root of a specified number. | |
static double | root3 (double a) |
Returns the cubic root of a specified number. | |
static double | exp (double a) |
Returns e raised to the specified power. | |
static double | log (double a) |
Returns the natural (base e) logarithm of a specified number. | |
static double | ln (double a) |
Returns the natural (base e) logarithm of a specified number. | |
static double | log10 (double a) |
Returns the base 10 logarithm of a specified number. | |
static double | lg (double a) |
Returns the base 10 logarithm of a specified number. | |
static double | log2 (double a) |
Returns the base 2 logarithm of a specified number. | |
static double | log (double a, double logBase) |
Returns the logarithm of a specified number in a specified base. | |
static double | deg (double x) |
Converts angle in radians to angle in degrees and returns it. | |
static double | rad (double x) |
Converts angle in degrees to angle in radians and returns it. | |
static double | sin (double a) |
Returns the sine of the specified angle. | |
static double | cos (double a) |
Returns the cosine of the specified angle. | |
static double | tg (double a) |
Returns the tangent of the specified angle. | |
static double | ctg (double x) |
Returns cotangent of the specified angle. | |
static double | arccos (double a) |
Returns the angle whose cosine is the specified number. | |
static double | arcsin (double a) |
Returns the angle whose sine is the specified number. | |
static double | arctg (double a) |
Returns the angle whose tangent is the specified number. | |
static double | arcctg (double x) |
Arc cotangent, inverse of 1/tan(x). | |
static double | arctg2 (double a, double b) |
Returns the angle whose tangent is the quotient of two specified numbers. | |
static double | Sinh (double a) |
Returns the hyperbolic sine of the specified angle. | |
static double | sinh (double a) |
Returns the hyperbolic sine of the specified angle. | |
static double | sh (double a) |
Returns the hyperbolic sine of the specified angle. | |
static double | ch (double a) |
Returns the hyperbolic cosine of the specified angle. | |
static double | th (double a) |
Returns the hyperbolic tangent of the specified angle. | |
static double | cth (double x) |
Hyperblic cotangent, 1/Math.Tanh. | |
static double | arsh (double x) |
Inverse hyperbolic sine. | |
static double | arch (double x) |
Inverse hyperbolic cosine. | |
static double | arth (double x) |
Inverse hyperbolic tangent. | |
static double | arcth (double x) |
Inverse hyperbolic cotangent. | |
static bool | CheckFactorialsArray () |
Tests ehether the factoirals in the hard-coded array (factorials64) of factorials are correct; Throws ArgumentException if any of them is incorrect. | |
static void | TestFactorials () |
Writes to the console all factorials that can be calculatet. | |
static void | TestFactorials (int max) |
Writes to the console the first n factorials. | |
static long | fac (int factor) |
Returns factorial of the specified number. | |
static long | facCalculated (long n) |
Returns factorial of the specified number - less efficient approac, but does not rely on hard coded array. | |
static long | fallingPower (long n, long p) |
Calculates and returns the falling power of the specified number. | |
static long | binomial (long n, long k) |
Returns binomial coefficient n over k . | |
static void | TestBinomialCoefficients () |
Writes the first few binomial coefficients to the console. | |
static void | TestBinomialCoefficients (int nMax) |
Writes binomial coefficients up to the specified number to the console. | |
Properties | |
static double | e [get] |
Natural logarithmic base. | |
static double | pi [get] |
Ratio of the circumference of a circle to its diameter. | |
static double | zero [get] |
Zero (value 0.0). | |
static double | one [get] |
One (value 1.0). | |
Static Private Attributes | |
static Int64[] | factorials64 |
Array of all factorials that do not produce overflow. | |
static bool | factorialsArrayChecked = false |
Whether or not factorials array has been tested. |
Defines some mathematical functions to be used in derived and other classes.
* Standard mathematical functions and constants with short names are implemented, e.g. sin() instesd of Math.Sin().
** These functions are public and static such that they can be used out of the derived classes, too.
*** In particular, some script classes derive from this one, in order to use simple-named mathematical functions.
** Some functions are defined with several names, in order to reduce probability of errors in scripts.
static void IG::Num::M::Swap | ( | ref double | a, |
ref double | b | ||
) | [inline, static] |
Swaps values of the two specified variables of type double.
a | First variable. |
b | Second variable. |
static void IG::Num::M::Swap | ( | ref int | a, |
ref int | b | ||
) | [inline, static] |
Swaps values of the two specified variables of type int.
a | First variable. |
b | Second variable. |
static void IG::Num::M::Swap | ( | ref string | a, |
ref string | b | ||
) | [inline, static] |
Swaps values of the two specified variables of type string.
a | First variable. |
b | Second variable. |
static double IG::Num::M::abs | ( | double | a | ) | [inline, static] |
Absolute value.
static double IG::Num::M::sign | ( | double | a | ) | [inline, static] |
Returns a value indicating the sign of a number.
static double IG::Num::M::ceil | ( | double | a | ) | [inline, static] |
Returns the smallest integral value that is greater than or equal to the specified decimal number.
static double IG::Num::M::floor | ( | double | a | ) | [inline, static] |
Returns the largest integer less than or equal to the specified number.
static double IG::Num::M::trunc | ( | double | a | ) | [inline, static] |
Calculates the integral part of a specified number.
static double IG::Num::M::min | ( | double | a, |
double | b | ||
) | [inline, static] |
Smallest of two numbers.
static double IG::Num::M::max | ( | double | a, |
double | b | ||
) | [inline, static] |
Largest of two numbers.
static double IG::Num::M::min | ( | double | a, |
double | b, | ||
double | c | ||
) | [inline, static] |
Smallest of three numbers.
static double IG::Num::M::max | ( | double | a, |
double | b, | ||
double | c | ||
) | [inline, static] |
Largest of three numbers.
static double IG::Num::M::min | ( | double | a, |
double | b, | ||
double | c, | ||
double | d | ||
) | [inline, static] |
Smallest of four numbers.
static double IG::Num::M::max | ( | double | a, |
double | b, | ||
double | c, | ||
double | d | ||
) | [inline, static] |
Largest of four numbers.
static double IG::Num::M::min | ( | double | a, |
double | b, | ||
double | c, | ||
double | d, | ||
double | e | ||
) | [inline, static] |
Smallest of five numbers.
static double IG::Num::M::max | ( | double | a, |
double | b, | ||
double | c, | ||
double | d, | ||
double | e | ||
) | [inline, static] |
Largest of five numbers.
static double IG::Num::M::min | ( | double | a, |
double | b, | ||
double | c, | ||
double | d, | ||
double | e, | ||
double | f | ||
) | [inline, static] |
Smallest of six numbers.
static double IG::Num::M::max | ( | double | a, |
double | b, | ||
double | c, | ||
double | d, | ||
double | e, | ||
double | f | ||
) | [inline, static] |
Largest of six numbers.
static double IG::Num::M::min | ( | params double[] | numbers | ) | [inline, static] |
Minimal of the specified values.
static double IG::Num::M::max | ( | params double[] | numbers | ) | [inline, static] |
Maximal of the specified values.
static double IG::Num::M::sum | ( | params double[] | numbers | ) | [inline, static] |
Sum of the specified values.
static double IG::Num::M::prod | ( | params double[] | numbers | ) | [inline, static] |
Product of the specified values.
static double IG::Num::M::pow | ( | double | a, |
double | b | ||
) | [inline, static] |
Returns a specified number raised to the specified power.
static double IG::Num::M::sqr | ( | double | a | ) | [inline, static] |
Returns the square of a specified number.
static double IG::Num::M::cube | ( | double | a | ) | [inline, static] |
Returns the square of a specified number.
static double IG::Num::M::pow2 | ( | double | x | ) | [inline, static] |
Square.
static double IG::Num::M::pow3 | ( | double | x | ) | [inline, static] |
3rd power.
static double IG::Num::M::pow4 | ( | double | x | ) | [inline, static] |
4th power.
static double IG::Num::M::pow5 | ( | double | x | ) | [inline, static] |
5th power.
static double IG::Num::M::pow6 | ( | double | x | ) | [inline, static] |
6th power.
static double IG::Num::M::sqrt | ( | double | a | ) | [inline, static] |
Returns the square root of a specified number.
static double IG::Num::M::root2 | ( | double | a | ) | [inline, static] |
Returns the square root of a specified number.
static double IG::Num::M::root3 | ( | double | a | ) | [inline, static] |
Returns the cubic root of a specified number.
static double IG::Num::M::exp | ( | double | a | ) | [inline, static] |
Returns e raised to the specified power.
static double IG::Num::M::log | ( | double | a | ) | [inline, static] |
Returns the natural (base e) logarithm of a specified number.
static double IG::Num::M::ln | ( | double | a | ) | [inline, static] |
Returns the natural (base e) logarithm of a specified number.
static double IG::Num::M::log10 | ( | double | a | ) | [inline, static] |
Returns the base 10 logarithm of a specified number.
static double IG::Num::M::lg | ( | double | a | ) | [inline, static] |
Returns the base 10 logarithm of a specified number.
static double IG::Num::M::log2 | ( | double | a | ) | [inline, static] |
Returns the base 2 logarithm of a specified number.
static double IG::Num::M::log | ( | double | a, |
double | logBase | ||
) | [inline, static] |
Returns the logarithm of a specified number in a specified base.
a | Number whose logarithm is returned. |
logBase | Base of the logarithm. |
static double IG::Num::M::deg | ( | double | x | ) | [inline, static] |
Converts angle in radians to angle in degrees and returns it.
static double IG::Num::M::rad | ( | double | x | ) | [inline, static] |
Converts angle in degrees to angle in radians and returns it.
static double IG::Num::M::sin | ( | double | a | ) | [inline, static] |
Returns the sine of the specified angle.
static double IG::Num::M::cos | ( | double | a | ) | [inline, static] |
Returns the cosine of the specified angle.
static double IG::Num::M::tg | ( | double | a | ) | [inline, static] |
Returns the tangent of the specified angle.
static double IG::Num::M::ctg | ( | double | x | ) | [inline, static] |
Returns cotangent of the specified angle.
static double IG::Num::M::arccos | ( | double | a | ) | [inline, static] |
Returns the angle whose cosine is the specified number.
static double IG::Num::M::arcsin | ( | double | a | ) | [inline, static] |
Returns the angle whose sine is the specified number.
static double IG::Num::M::arctg | ( | double | a | ) | [inline, static] |
Returns the angle whose tangent is the specified number.
static double IG::Num::M::arcctg | ( | double | x | ) | [inline, static] |
Arc cotangent, inverse of 1/tan(x).
static double IG::Num::M::arctg2 | ( | double | a, |
double | b | ||
) | [inline, static] |
Returns the angle whose tangent is the quotient of two specified numbers.
static double IG::Num::M::Sinh | ( | double | a | ) | [inline, static] |
Returns the hyperbolic sine of the specified angle.
Reimplemented in IG::Num::MExt.
static double IG::Num::M::sinh | ( | double | a | ) | [inline, static] |
Returns the hyperbolic sine of the specified angle.
Reimplemented in IG::Num::MExt.
static double IG::Num::M::sh | ( | double | a | ) | [inline, static] |
Returns the hyperbolic sine of the specified angle.
static double IG::Num::M::ch | ( | double | a | ) | [inline, static] |
Returns the hyperbolic cosine of the specified angle.
static double IG::Num::M::th | ( | double | a | ) | [inline, static] |
Returns the hyperbolic tangent of the specified angle.
static double IG::Num::M::cth | ( | double | x | ) | [inline, static] |
Hyperblic cotangent, 1/Math.Tanh.
static double IG::Num::M::arsh | ( | double | x | ) | [inline, static] |
Inverse hyperbolic sine.
static double IG::Num::M::arch | ( | double | x | ) | [inline, static] |
Inverse hyperbolic cosine.
static double IG::Num::M::arth | ( | double | x | ) | [inline, static] |
Inverse hyperbolic tangent.
static double IG::Num::M::arcth | ( | double | x | ) | [inline, static] |
Inverse hyperbolic cotangent.
static bool IG::Num::M::CheckFactorialsArray | ( | ) | [inline, static] |
Tests ehether the factoirals in the hard-coded array (factorials64) of factorials are correct; Throws ArgumentException if any of them is incorrect.
static void IG::Num::M::TestFactorials | ( | ) | [inline, static] |
Writes to the console all factorials that can be calculatet.
max | Largest number whose factorial will be calculated. |
static void IG::Num::M::TestFactorials | ( | int | max | ) | [inline, static] |
Writes to the console the first n factorials.
max | Largest number whose factorial will be calculated. |
static long IG::Num::M::fac | ( | int | factor | ) | [inline, static] |
Returns factorial of the specified number.
static long IG::Num::M::facCalculated | ( | long | n | ) | [inline, static] |
Returns factorial of the specified number - less efficient approac, but does not rely on hard coded array.
static long IG::Num::M::fallingPower | ( | long | n, |
long | p | ||
) | [inline, static] |
Calculates and returns the falling power of the specified number.
n | |
p |
static long IG::Num::M::binomial | ( | long | n, |
long | k | ||
) | [inline, static] |
Returns binomial coefficient n over k .
n | |
k |
static void IG::Num::M::TestBinomialCoefficients | ( | ) | [inline, static] |
Writes the first few binomial coefficients to the console.
static void IG::Num::M::TestBinomialCoefficients | ( | int | nMax | ) | [inline, static] |
Writes binomial coefficients up to the specified number to the console.
n | Maximal enumerator until which coefficients are written. |
Int64 [] IG::Num::M::factorials64 [static, private] |
{ 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000, 2432902008176640000 }
Array of all factorials that do not produce overflow.
bool IG::Num::M::factorialsArrayChecked = false [static, private] |
Whether or not factorials array has been tested.
double IG::Num::M::e [static, get] |
Natural logarithmic base.
Reimplemented in IG::Num::Experimental::MX.
double IG::Num::M::pi [static, get] |
Ratio of the circumference of a circle to its diameter.
Reimplemented in IG::Num::Experimental::MX.
double IG::Num::M::zero [static, get] |
Zero (value 0.0).
Reimplemented in IG::Num::Experimental::MX.
double IG::Num::M::one [static, get] |
One (value 1.0).
Reimplemented in IG::Num::Experimental::MX.