Mathematical Constants
Many mathematical constants and expressions involving small integers occur time and again in numerical calculations. The Constants class contains static fields for many of these values.
The constants fall into four categories:
This topic contains the following sections:
- Fundamental constants
- Expressions involving fundamental constants
- Square roots of small integers.
- Logarithms of small integers.
The following example shows a method that evaluates the probability density function of a normal distribution with mean mean and standard deviation stdDev.
public double NormalPDF(double x, double mean, double stdDev)
{
double z = (x - mean) / stdDev;
return Constants.OneOverSqrtTwoPi / stdDev
* Math.Exp(-0.5 * z * z);
}
The tables below list the constants in each of the four categories.
Fundamental constants
Value | Description |
---|---|
The base for the natural logarithm, e (2.718...). | |
Euler's constant, which is important in number theory and some engineering calculations (0.577...). | |
The Golden Ratio (1.618...). | |
The number Pi, the ratio between the circumference and the diameter of a circle (3.1415...). |
Expressions involving fundamental constants
Value | Description |
---|---|
Two times Pi (6.283...). | |
0.5 times Pi (1.570...). | |
0.25 times Pi (0.785...). | |
The natural logarithm of two times Pi (1.837...). | |
The square of Pi (9.869...). | |
The square root of Pi (1.772...). | |
The square root of two times Pi (2.506...). | |
The reciprocal of the square root of Pi (0.564...). | |
The reciprocal of the square root of two times Pi (0.399...). |
Square roots of small integers.
Value | Description |
---|---|
The square root of two (1.414...). | |
The square root of three (1.732...). | |
The square root of five (2.236...). | |
The square root of seven (2.646...). | |
The square root of seventeen (4.123...). |