Skip to content

Commit 31a6970

Browse files
committed
Correct argument order for BrentSolver
1 parent 4484083 commit 31a6970

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

commons-numbers-rootfinder/src/test/java/org/apache/commons/numbers/rootfinder/BrentSolverTest.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ void testSinZero() {
3535
// order derivative is zero, which means linar approximating methods will
3636
// still converge quadratically.
3737
final DoubleUnaryOperator func = new Sin();
38-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
39-
DEFAULT_RELATIVE_ACCURACY,
38+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
39+
DEFAULT_ABSOLUTE_ACCURACY,
4040
DEFAULT_FUNCTION_ACCURACY);
4141

4242
double result;
@@ -65,8 +65,8 @@ void testQuinticZero() {
6565
// The function has extrema (first derivative is zero) at 0.27195613 and 0.82221643,
6666
// intervals containing these values are harder for the solvers.
6767
final DoubleUnaryOperator func = new QuinticFunction();
68-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
69-
DEFAULT_RELATIVE_ACCURACY,
68+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
69+
DEFAULT_ABSOLUTE_ACCURACY,
7070
DEFAULT_FUNCTION_ACCURACY);
7171

7272
double result;
@@ -142,8 +142,8 @@ void testQuinticZero() {
142142
@Test
143143
void testTooManyCalls() {
144144
final DoubleUnaryOperator func = new QuinticFunction();
145-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
146-
DEFAULT_RELATIVE_ACCURACY,
145+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
146+
DEFAULT_ABSOLUTE_ACCURACY,
147147
DEFAULT_FUNCTION_ACCURACY);
148148

149149
// Very large bracket around 1 for testing fast growth behavior.
@@ -162,8 +162,8 @@ void testTooManyCalls() {
162162
@Test
163163
void testRootEndpoints() {
164164
final DoubleUnaryOperator f = new Sin();
165-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
166-
DEFAULT_RELATIVE_ACCURACY,
165+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
166+
DEFAULT_ABSOLUTE_ACCURACY,
167167
DEFAULT_FUNCTION_ACCURACY);
168168

169169
// Endpoint is root.
@@ -183,8 +183,8 @@ void testRootEndpoints() {
183183
@Test
184184
void testBadEndpoints() {
185185
final DoubleUnaryOperator f = new Sin();
186-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
187-
DEFAULT_RELATIVE_ACCURACY,
186+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
187+
DEFAULT_ABSOLUTE_ACCURACY,
188188
DEFAULT_FUNCTION_ACCURACY);
189189
try { // Bad interval.
190190
solver.findRoot(f, 1, -1);
@@ -212,8 +212,8 @@ void testBadEndpoints() {
212212
@Test
213213
void testBadInitialGuess() {
214214
final DoubleUnaryOperator func = new QuinticFunction();
215-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
216-
DEFAULT_RELATIVE_ACCURACY,
215+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
216+
DEFAULT_ABSOLUTE_ACCURACY,
217217
DEFAULT_FUNCTION_ACCURACY);
218218

219219
try {
@@ -229,8 +229,8 @@ void testBadInitialGuess() {
229229
@Test
230230
void testInitialGuess() {
231231
final DoubleUnaryOperator func = new QuinticFunction();
232-
final BrentSolver solver = new BrentSolver(DEFAULT_ABSOLUTE_ACCURACY,
233-
DEFAULT_RELATIVE_ACCURACY,
232+
final BrentSolver solver = new BrentSolver(DEFAULT_RELATIVE_ACCURACY,
233+
DEFAULT_ABSOLUTE_ACCURACY,
234234
DEFAULT_FUNCTION_ACCURACY);
235235
double result;
236236
MonitoredFunction f;

0 commit comments

Comments
 (0)