diff --git a/src/Numerics.Tests/SpecialFunctionsTests/GammaTests.cs b/src/Numerics.Tests/SpecialFunctionsTests/GammaTests.cs
index ad07226c..1357fd9e 100644
--- a/src/Numerics.Tests/SpecialFunctionsTests/GammaTests.cs
+++ b/src/Numerics.Tests/SpecialFunctionsTests/GammaTests.cs
@@ -52,7 +52,7 @@ namespace MathNet.Numerics.UnitTests.SpecialFunctionsTests
[TestCase(1.0, 1.0, 15)]
[TestCase(1.0 + 1.0e-14, 0.99999999999999422784335098477029953441189552403615306268023, 14)]
[TestCase(1.5, 0.886226925452758013649083741670572591398774728061193564106903, 13)]
- [TestCase(Constants.Pi/2, 0.890560890381539328010659635359121005933541962884758999762766, 14)]
+ [TestCase(Constants.PiOver2, 0.890560890381539328010659635359121005933541962884758999762766, 14)]
[TestCase(2.0, 1.0, 16)]
[TestCase(2.5, 1.329340388179137020473625612505858887098162092091790346160355, 14)]
[TestCase(3.0, 2.0, 13)]
@@ -81,7 +81,7 @@ namespace MathNet.Numerics.UnitTests.SpecialFunctionsTests
[TestCase(1.0, 0.0, 14)]
[TestCase(1.0 + 1.0e-14, -5.77215664901524635936177848990288632404978978079827014e-15, 0)]
[TestCase(1.5, -0.12078223763524522234551844578164721225185272790259946836386, 13)]
- [TestCase(Constants.Pi/2, -0.11590380084550241329912089415904874214542604767006895, 13)]
+ [TestCase(Constants.PiOver2, -0.11590380084550241329912089415904874214542604767006895, 13)]
[TestCase(2.0, 0.0, 14)]
[TestCase(2.5, 0.284682870472919159632494669682701924320137695559894729250145, 13)]
[TestCase(3.0, 0.693147180559945309417232121458176568075500134360255254120680, 13)]
diff --git a/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs b/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs
index 1316932d..b1023717 100644
--- a/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs
+++ b/src/Numerics.Tests/SpecialFunctionsTests/SpecialFunctionsTests.cs
@@ -49,7 +49,7 @@ namespace MathNet.Numerics.UnitTests.SpecialFunctionsTests
[TestCase(0.1, -10.423754940411076232100295314502760886768558023951363)]
[TestCase(1.0, -0.57721566490153286060651209008240243104215933593992359)]
[TestCase(1.5, 0.036489973978576520559023667001244432806840395339565888)]
- [TestCase(Constants.Pi / 2, 0.10067337642740238636795561404029690452798358068944001)]
+ [TestCase(Constants.PiOver2, 0.10067337642740238636795561404029690452798358068944001)]
[TestCase(2.0, 0.42278433509846713939348790991759756895784066406007641)]
[TestCase(2.5, 0.70315664064524318722569033366791109947350706200623255)]
[TestCase(3.0, 0.92278433509846713939348790991759756895784066406007641)]
@@ -75,7 +75,7 @@ namespace MathNet.Numerics.UnitTests.SpecialFunctionsTests
[TestCase(0.1, -10.423754940411076232100295314502760886768558023951363)]
[TestCase(1.0, -0.57721566490153286060651209008240243104215933593992359)]
[TestCase(1.5, 0.036489973978576520559023667001244432806840395339565888)]
- [TestCase(Constants.Pi / 2, 0.10067337642740238636795561404029690452798358068944001)]
+ [TestCase(Constants.PiOver2, 0.10067337642740238636795561404029690452798358068944001)]
[TestCase(2.0, 0.42278433509846713939348790991759756895784066406007641)]
[TestCase(2.5, 0.70315664064524318722569033366791109947350706200623255)]
[TestCase(3.0, 0.92278433509846713939348790991759756895784066406007641)]
diff --git a/src/Numerics.Tests/StatisticsTests/CorrelationTests.cs b/src/Numerics.Tests/StatisticsTests/CorrelationTests.cs
index ca1e34e2..4d97e938 100644
--- a/src/Numerics.Tests/StatisticsTests/CorrelationTests.cs
+++ b/src/Numerics.Tests/StatisticsTests/CorrelationTests.cs
@@ -92,7 +92,7 @@ namespace MathNet.Numerics.UnitTests.StatisticsTests
var tol = 1e-14;
var n = 10;
// make some dummy data
- var a = Generate.LinearSpacedMap(n, 0, 2*Constants.Pi, Math.Sin);
+ var a = Generate.LinearSpacedMap(n, 0, Constants.Pi2, Math.Sin);
var idxs = new int[] { 2, 1, 7 };
diff --git a/src/Numerics/Distributions/Cauchy.cs b/src/Numerics/Distributions/Cauchy.cs
index f6d9b1bd..3c626179 100644
--- a/src/Numerics/Distributions/Cauchy.cs
+++ b/src/Numerics/Distributions/Cauchy.cs
@@ -203,7 +203,7 @@ namespace MathNet.Numerics.Distributions
///
public double CumulativeDistribution(double x)
{
- return ((1.0/Constants.Pi)*Math.Atan((x - _location)/_scale)) + 0.5;
+ return Constants.InvPi*Math.Atan((x - _location)/_scale) + 0.5;
}
///
diff --git a/src/Numerics/Distributions/MatrixNormal.cs b/src/Numerics/Distributions/MatrixNormal.cs
index 791c29f2..464595ef 100644
--- a/src/Numerics/Distributions/MatrixNormal.cs
+++ b/src/Numerics/Distributions/MatrixNormal.cs
@@ -195,7 +195,7 @@ namespace MathNet.Numerics.Distributions
var cholK = _k.Cholesky();
return Math.Exp(-0.5*cholK.Solve(a.Transpose()*cholV.Solve(a)).Trace())
- /Math.Pow(2.0*Constants.Pi, x.RowCount*x.ColumnCount/2.0)
+ /Math.Pow(Constants.Pi2, x.RowCount*x.ColumnCount/2.0)
/Math.Pow(cholK.Determinant, x.RowCount/2.0)
/Math.Pow(cholV.Determinant, x.ColumnCount/2.0);
}
diff --git a/src/Numerics/Distributions/Poisson.cs b/src/Numerics/Distributions/Poisson.cs
index e835ac00..16e0def9 100644
--- a/src/Numerics/Distributions/Poisson.cs
+++ b/src/Numerics/Distributions/Poisson.cs
@@ -133,7 +133,7 @@ namespace MathNet.Numerics.Distributions
/// Gets the entropy of the distribution.
///
/// Approximation, see Wikipedia Poisson distribution
- public double Entropy => (0.5*Math.Log(2*Constants.Pi*Constants.E*_lambda)) - (1.0/(12.0*_lambda)) - (1.0/(24.0*_lambda*_lambda)) - (19.0/(360.0*_lambda*_lambda*_lambda));
+ public double Entropy => (0.5*Math.Log(Constants.Pi2*Constants.E*_lambda)) - (1.0/(12.0*_lambda)) - (1.0/(24.0*_lambda*_lambda)) - (19.0/(360.0*_lambda*_lambda*_lambda));
///
/// Gets the skewness of the distribution.
diff --git a/src/Numerics/Distributions/SkewedGeneralizedError.cs b/src/Numerics/Distributions/SkewedGeneralizedError.cs
index 8ef9fe08..6570a2da 100644
--- a/src/Numerics/Distributions/SkewedGeneralizedError.cs
+++ b/src/Numerics/Distributions/SkewedGeneralizedError.cs
@@ -212,7 +212,7 @@ namespace MathNet.Numerics.Distributions
static double AdjustAddend(double scale, double skew, double p)
{
return (Math.Pow(2.0, 2.0 / p) * scale * skew * SpecialFunctions.Gamma(1.0 / 2.0 + 1.0 / p)) /
- Math.Sqrt(Constants.Pi);
+ Constants.SqrtPi;
}
public static double PDF(double location, double scale, double skew, double p, double x)
diff --git a/src/Numerics/RootFinding/Cubic.cs b/src/Numerics/RootFinding/Cubic.cs
index c9985cad..4cb27304 100644
--- a/src/Numerics/RootFinding/Cubic.cs
+++ b/src/Numerics/RootFinding/Cubic.cs
@@ -94,8 +94,8 @@ namespace MathNet.Numerics.RootFinding
// 3 real roots, use eqn (70)-(73) to calculate the real roots
double theta = Math.Acos(R/Math.Sqrt(-Q3));
x1 = 2d*Math.Sqrt(-Q)*Math.Cos(theta/3.0) + shift;
- x2 = 2d*Math.Sqrt(-Q)*Math.Cos((theta + 2.0*Constants.Pi)/3d) + shift;
- x3 = 2d*Math.Sqrt(-Q)*Math.Cos((theta - 2.0*Constants.Pi)/3d) + shift;
+ x2 = 2d*Math.Sqrt(-Q)*Math.Cos((theta + Constants.Pi2)/3d) + shift;
+ x3 = 2d*Math.Sqrt(-Q)*Math.Cos((theta - Constants.Pi2)/3d) + shift;
}
return new Tuple(x1, x2, x3);