[MATH-1204] backport to 3.5 branch.
This commit is contained in:
parent
68e6de3519
commit
9aa6382673
|
@ -54,6 +54,10 @@ If the output is not quite correct, check for invisible trailing spaces!
|
||||||
</release>
|
</release>
|
||||||
|
|
||||||
<release version="3.5" date="2015-01-11" description="">
|
<release version="3.5" date="2015-01-11" description="">
|
||||||
|
<action dev="evanward" type="fix" issue="MATH-1204">
|
||||||
|
"UnivariateSolverUtils#bracket(...)" sometimes failed to bracket
|
||||||
|
if a reached the lower bound.
|
||||||
|
</action>
|
||||||
<action dev="sebb" type="add" issue="MATH-1198">
|
<action dev="sebb" type="add" issue="MATH-1198">
|
||||||
Simplified "FastMath#exp(double)" in order to avoid a potential
|
Simplified "FastMath#exp(double)" in order to avoid a potential
|
||||||
Java 1.5 JIT bug when calling with negative infinity as argument.
|
Java 1.5 JIT bug when calling with negative infinity as argument.
|
||||||
|
|
|
@ -243,7 +243,7 @@ public class UnivariateSolverUtils {
|
||||||
* \( \delta_{k+1} = r \delta_k + q, \delta_0 = 0\) and starting search with \( k=1 \).
|
* \( \delta_{k+1} = r \delta_k + q, \delta_0 = 0\) and starting search with \( k=1 \).
|
||||||
* The algorithm stops when one of the following happens: <ul>
|
* The algorithm stops when one of the following happens: <ul>
|
||||||
* <li> at least one positive and one negative value have been found -- success!</li>
|
* <li> at least one positive and one negative value have been found -- success!</li>
|
||||||
* <li> both endpoints have reached their respective limites -- NoBracketingException </li>
|
* <li> both endpoints have reached their respective limits -- NoBracketingException </li>
|
||||||
* <li> {@code maximumIterations} iterations elapse -- NoBracketingException </li></ul></p>
|
* <li> {@code maximumIterations} iterations elapse -- NoBracketingException </li></ul></p>
|
||||||
* <p>
|
* <p>
|
||||||
* If different signs are found at first iteration ({@code k=1}), then the returned
|
* If different signs are found at first iteration ({@code k=1}), then the returned
|
||||||
|
@ -257,7 +257,7 @@ public class UnivariateSolverUtils {
|
||||||
* Interval expansion rate is tuned by changing the recurrence parameters {@code r} and
|
* Interval expansion rate is tuned by changing the recurrence parameters {@code r} and
|
||||||
* {@code q}. When the multiplicative factor {@code r} is set to 1, the sequence is a
|
* {@code q}. When the multiplicative factor {@code r} is set to 1, the sequence is a
|
||||||
* simple arithmetic sequence with linear increase. When the multiplicative factor {@code r}
|
* simple arithmetic sequence with linear increase. When the multiplicative factor {@code r}
|
||||||
* is larger than 1, the sequence has an asymtotically exponential rate. Note than the
|
* is larger than 1, the sequence has an asymptotically exponential rate. Note than the
|
||||||
* additive parameter {@code q} should never be set to zero, otherwise the interval would
|
* additive parameter {@code q} should never be set to zero, otherwise the interval would
|
||||||
* degenerate to the single initial point for all values of {@code k}.
|
* degenerate to the single initial point for all values of {@code k}.
|
||||||
* </p>
|
* </p>
|
||||||
|
@ -314,7 +314,7 @@ public class UnivariateSolverUtils {
|
||||||
double delta = 0;
|
double delta = 0;
|
||||||
|
|
||||||
for (int numIterations = 0;
|
for (int numIterations = 0;
|
||||||
(numIterations < maximumIterations) && (a > lowerBound || b > upperBound);
|
(numIterations < maximumIterations) && (a > lowerBound || b < upperBound);
|
||||||
++numIterations) {
|
++numIterations) {
|
||||||
|
|
||||||
final double previousA = a;
|
final double previousA = a;
|
||||||
|
|
|
@ -175,6 +175,14 @@ public class UnivariateSolverUtilsTest {
|
||||||
UnivariateSolverUtils.bracket(sin, 1.5, 0, 2.0, 0);
|
UnivariateSolverUtils.bracket(sin, 1.5, 0, 2.0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** check the search continues when a = lowerBound and b < upperBound. */
|
||||||
|
@Test
|
||||||
|
public void testBracketLoopConditionForB() {
|
||||||
|
double[] result = UnivariateSolverUtils.bracket(sin, -0.9, -1, 1, 0.1, 1, 100);
|
||||||
|
Assert.assertTrue(result[0] <= 0);
|
||||||
|
Assert.assertTrue(result[1] >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMisc() {
|
public void testMisc() {
|
||||||
UnivariateFunction f = new QuinticFunction();
|
UnivariateFunction f = new QuinticFunction();
|
||||||
|
|
Loading…
Reference in New Issue