diff --git a/src/Numerics/Properties/Resources.Designer.cs b/src/Numerics/Properties/Resources.Designer.cs
index 13e9f0d28..0a336eb01 100644
--- a/src/Numerics/Properties/Resources.Designer.cs
+++ b/src/Numerics/Properties/Resources.Designer.cs
@@ -60,6 +60,15 @@ internal Resources() {
}
}
+ ///
+ /// Looks up a localized string similar to The accuracy couldn't be reached with the specified number of iterations..
+ ///
+ public static string AccuracyNotReached {
+ get {
+ return ResourceManager.GetString("AccuracyNotReached", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The array arguments must have the same length..
///
@@ -744,6 +753,15 @@ public static string ProposalDistributionNoUpperBound {
}
}
+ ///
+ /// Looks up a localized string similar to The algorithm ended without root in the range..
+ ///
+ public static string RootNotFound {
+ get {
+ return ResourceManager.GetString("RootNotFound", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The number of rows must greater than or equal to the number of columns..
///
diff --git a/src/Numerics/Properties/Resources.resx b/src/Numerics/Properties/Resources.resx
index 2d7c5c10a..e0645a91d 100644
--- a/src/Numerics/Properties/Resources.resx
+++ b/src/Numerics/Properties/Resources.resx
@@ -369,10 +369,16 @@
We only support sparse matrix with less than int.MaxValue elements.
-
- Sample points should be sorted in strictly ascending order
+
+ Sample points should be sorted in strictly ascending order
-
- All sample points should be unique.
+
+ All sample points should be unique.
+
+
+ The accuracy couldn't be reached with the specified number of iterations.
+
+
+ The algorithm ended without root in the range.
\ No newline at end of file
diff --git a/src/Numerics/RootFinding/BrentRootFinder.cs b/src/Numerics/RootFinding/BrentRootFinder.cs
index 82ec8b2da..d5f4bb90d 100644
--- a/src/Numerics/RootFinding/BrentRootFinder.cs
+++ b/src/Numerics/RootFinding/BrentRootFinder.cs
@@ -1,4 +1,5 @@
using System;
+using MathNet.Numerics.Properties;
namespace MathNet.Numerics.RootFinding
{
@@ -108,7 +109,7 @@ University Press
}
// The algorithm has exceeded the number of iterations allowed
- throw new RootFinderException(ACCURACY_NOT_REACHED, i, new Range(XMin, XMax), Math.Abs(xMid));
+ throw new RootFinderException(Resources.AccuracyNotReached, i, new Range(XMin, XMax), Math.Abs(xMid));
}
}
}
diff --git a/src/Numerics/RootFinding/RootFinder.cs b/src/Numerics/RootFinding/RootFinder.cs
index 94115c6f7..4d56a650e 100644
--- a/src/Numerics/RootFinding/RootFinder.cs
+++ b/src/Numerics/RootFinding/RootFinder.cs
@@ -1,4 +1,5 @@
using System;
+using MathNet.Numerics.Properties;
namespace MathNet.Numerics.RootFinding
{
@@ -41,13 +42,7 @@ public Range Range
}
public abstract class RootFinder
{
-
- protected const string INVALID_RANGE="Invalid range while finding root";
- protected const string ACCURACY_NOT_REACHED = "The accuracy couldn't be reached with the specified number of iterations";
- protected const string ROOT_NOT_FOUND = "The algorithm ended without root in the range";
- protected const string ROOT_NOT_BRACKETED = "The algorithm could not start because the root seemed not to be bracketed";
- protected const string INVALID_ALGORITHM = "This algorithm is not able to solve this equation";
- protected const double DOUBLE_ACCURACY = 9.99200722162641E-16;
+ protected const double DOUBLE_ACCURACY = 9.99200722162641E-16;
private const int DEFAULT_MAX_ITERATIONS = 30;
private const double DEFAULT_ACCURACY = 1e-8;
@@ -122,7 +117,7 @@ public bool SearchBracketsOutward(ref double xmin, ref double xmax, double facto
{
if (xmin >= xmax)
{
- throw new RootFinderException(INVALID_RANGE, 0, new Range(xmin, xmax), 0.0);
+ throw new RootFinderException(string.Format(Resources.ArgumentOutOfRangeGreater,"xmax","xmin"), 0, new Range(xmin, xmax), 0.0);
}
double fmin = _func(xmin);
@@ -144,7 +139,7 @@ public bool SearchBracketsOutward(ref double xmin, ref double xmax, double facto
}
}
- throw new RootFinderException(ROOT_NOT_FOUND, i, new Range(fmin, fmax), 0.0);
+ throw new RootFinderException(Resources.RootNotFound, i, new Range(fmin, fmax), 0.0);
}
/// Prototype algorithm for solving the equation f(x)=0.