diff --git a/src/Numerics/Constants.cs b/src/Numerics/Constants.cs
index ef7734d1..386694aa 100644
--- a/src/Numerics/Constants.cs
+++ b/src/Numerics/Constants.cs
@@ -67,6 +67,9 @@ namespace MathNet.Numerics
/// The number sqrt(2)
public const double Sqrt2 = 1.4142135623730950488016887242096980785696718753769d;
+ /// The number sqrt(3)
+ public const double Sqrt3 = 1.7320508075688772935274463415058723669428052538104d;
+
/// The number sqrt(1/2) = 1/sqrt(2) = sqrt(2)/2
public const double Sqrt1Over2 = 0.70710678118654752440084436210484903928483593768845d;
diff --git a/src/Numerics/RootFinding/Cubic.cs b/src/Numerics/RootFinding/Cubic.cs
index 7fbd9541..7921ca21 100644
--- a/src/Numerics/RootFinding/Cubic.cs
+++ b/src/Numerics/RootFinding/Cubic.cs
@@ -82,7 +82,7 @@ namespace MathNet.Numerics.RootFinding
var S = Complex.Pow(R + rootD, 1d / 3d);
var T = Complex.Pow(R - rootD, 1d / 3d);
var shift = -a2 / 3d;
- var sharedI = 0.5 * Complex.ImaginaryOne * Math.Sqrt(3) * (S - T);
+ var sharedI = 0.5 * Complex.ImaginaryOne * Constants.Sqrt3 * (S - T);
var x1 = shift + (S + T);
var x2 = shift - 0.5 * (S + T);
diff --git a/src/UnitTests/ComplexTests/Complex32Test.cs b/src/UnitTests/ComplexTests/Complex32Test.cs
index 0acccf26..ec28709c 100644
--- a/src/UnitTests/ComplexTests/Complex32Test.cs
+++ b/src/UnitTests/ComplexTests/Complex32Test.cs
@@ -290,7 +290,7 @@ namespace MathNet.Numerics.UnitTests.ComplexTests
public void CanCreateComplexNumberWithModulusArgument()
{
var complex = Complex32.FromPolarCoordinates(2, (float)-Math.PI / 6);
- Assert.AreEqual((float)Math.Sqrt(3), complex.Real, 1e-7f, "Real part is Sqrt(3).");
+ Assert.AreEqual((float)Constants.Sqrt3, complex.Real, 1e-7f, "Real part is Sqrt(3).");
Assert.AreEqual(-1.0f, complex.Imaginary, 1e-7f, "Imaginary part is -1.");
}
diff --git a/src/UnitTests/RootFindingTests/RobustNewtonRaphsonTest.cs b/src/UnitTests/RootFindingTests/RobustNewtonRaphsonTest.cs
index 6c341c42..4986898f 100644
--- a/src/UnitTests/RootFindingTests/RobustNewtonRaphsonTest.cs
+++ b/src/UnitTests/RootFindingTests/RobustNewtonRaphsonTest.cs
@@ -86,17 +86,17 @@ namespace MathNet.Numerics.UnitTests.RootFindingTests
Func f3 = x => 1/(x - 2) + x + 2;
Func df3 = x => -1/(x*x - 4*x + 4) + 1;
- Assert.AreEqual(-Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f3, df3, -2, -1, 1e-14, 100, 20), 1e-14);
- Assert.AreEqual(Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f3, df3, 1, 1.99, 1e-14, 100, 20));
- Assert.AreEqual(Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f3, df3, -1.5, 1.99, 1e-14, 100, 20));
- Assert.AreEqual(Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f3, df3, 1, 6, 1e-14, 100, 20));
+ Assert.AreEqual(-Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f3, df3, -2, -1, 1e-14, 100, 20), 1e-14);
+ Assert.AreEqual(Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f3, df3, 1, 1.99, 1e-14, 100, 20));
+ Assert.AreEqual(Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f3, df3, -1.5, 1.99, 1e-14, 100, 20));
+ Assert.AreEqual(Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f3, df3, 1, 6, 1e-14, 100, 20));
Func f4 = x => 1/(2 - x) - x + 6;
Func df4 = x => 1/(x*x - 4*x + 4) - 1;
- Assert.AreEqual(4 + Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f4, df4, 5, 6, 1e-14, 100, 20), 1e-14);
- Assert.AreEqual(4 - Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f4, df4, 2.01, 3, 1e-14, 100, 20));
- Assert.AreEqual(4 - Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f4, df4, 2.01, 5, 1e-14, 100, 20));
- Assert.AreEqual(4 - Math.Sqrt(3), RobustNewtonRaphson.FindRoot(f4, df4, -2, 4, 1e-14, 100, 20));
+ Assert.AreEqual(4 + Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f4, df4, 5, 6, 1e-14, 100, 20), 1e-14);
+ Assert.AreEqual(4 - Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f4, df4, 2.01, 3, 1e-14, 100, 20));
+ Assert.AreEqual(4 - Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f4, df4, 2.01, 5, 1e-14, 100, 20));
+ Assert.AreEqual(4 - Constants.Sqrt3, RobustNewtonRaphson.FindRoot(f4, df4, -2, 4, 1e-14, 100, 20));
}
[Test]