1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.math.analysis;
17
18 /**
19 * A concrete {@link UnivariateRealSolverFactory}. This is the default solver factory
20 * used by commons-math.
21 * <p>
22 * The default solver returned by this factory is a {@link BrentSolver}.
23 *
24 * @version $Revision: 155427 $ $Date: 2005-02-26 06:11:52 -0700 (Sat, 26 Feb 2005) $
25 */
26 public class UnivariateRealSolverFactoryImpl extends UnivariateRealSolverFactory {
27
28 /**
29 * Default constructor.
30 */
31 public UnivariateRealSolverFactoryImpl() {
32 }
33
34 /**
35 * Create a new {@link UnivariateRealSolver} for the given function. The
36 * actual solver returned is determined by the underlying factory.
37 *
38 * This factory returns a {@link BrentSolver} instance.
39 *
40 * @param f the function.
41 * @return the new solver.
42 */
43 public UnivariateRealSolver newDefaultSolver(UnivariateRealFunction f) {
44 return newBrentSolver(f);
45 }
46
47 /**
48 * Create a new {@link UnivariateRealSolver} for the given function. The
49 * solver is an implementation of the bisection method.
50 * @param f the function.
51 * @return the new solver.
52 */
53 public UnivariateRealSolver newBisectionSolver(UnivariateRealFunction f) {
54 return new BisectionSolver(f);
55 }
56
57 /**
58 * Create a new {@link UnivariateRealSolver} for the given function. The
59 * solver is an implementation of the Brent method.
60 * @param f the function.
61 * @return the new solver.
62 */
63 public UnivariateRealSolver newBrentSolver(UnivariateRealFunction f) {
64 return new BrentSolver(f);
65 }
66
67 /**
68 * Create a new {@link UnivariateRealSolver} for the given function. The
69 * solver is an implementation of Newton's Method.
70 * @param f the function.
71 * @return the new solver.
72 */
73 public UnivariateRealSolver newNewtonSolver(
74 DifferentiableUnivariateRealFunction f) {
75
76 return new NewtonSolver(f);
77 }
78
79 /**
80 * Create a new {@link UnivariateRealSolver} for the given function. The
81 * solver is an implementation of the secant method.
82 * @param f the function.
83 * @return the new solver.
84 */
85 public UnivariateRealSolver newSecantSolver(UnivariateRealFunction f) {
86 return new SecantSolver(f);
87 }
88 }