1/*2* Licensed to the Apache Software Foundation (ASF) under one or more3* contributor license agreements. See the NOTICE file distributed with4* this work for additional information regarding copyright ownership.5* The ASF licenses this file to You under the Apache License, Version 2.06* (the "License"); you may not use this file except in compliance with7* the License. You may obtain a copy of the License at8*9* http://www.apache.org/licenses/LICENSE-2.010*11* Unless required by applicable law or agreed to in writing, software12* distributed under the License is distributed on an "AS IS" BASIS,13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14* See the License for the specific language governing permissions and15* limitations under the License.16*/17 18packageorg.apache.commons.math3.analysis.solvers; 19 20/**21* Implements the <em>Pegasus</em> method for root-finding (approximating22* a zero of a univariate real function). It is a modified23* {@link RegulaFalsiSolver <em>Regula Falsi</em>} method.24*25* <p>Like the <em>Regula Falsi</em> method, convergence is guaranteed by26* maintaining a bracketed solution. The <em>Pegasus</em> method however,27* should converge much faster than the original <em>Regula Falsi</em>28* method. Furthermore, this implementation of the <em>Pegasus</em> method29* should not suffer from the same implementation issues as the <em>Regula30* Falsi</em> method, which may fail to convergence in certain cases. Also,31* the <em>Pegasus</em> method should converge faster than the32* {@link IllinoisSolver <em>Illinois</em>} method, another <em>Regula33* Falsi</em>-based method.</p>34*35* <p>The <em>Pegasus</em> method assumes that the function is continuous,36* but not necessarily smooth.</p>37*38* <p>Implementation based on the following article: M. Dowell and P. Jarratt,39* <em>The "Pegasus" method for computing the root of an equation</em>,40* BIT Numerical Mathematics, volume 12, number 4, pages 503-508, Springer,41* 1972.</p>42*43* @since 3.044* @version $Id: PegasusSolver.java 1364387 2012-07-22 18:14:11Z tn $45*/46publicclassPegasusSolverextendsBaseSecantSolver { 47 48/**Construct a solver with default accuracy (1e-6). */49publicPegasusSolver() { 50super(DEFAULT_ABSOLUTE_ACCURACY, Method.PEGASUS); 51 } 52 53/**54* Construct a solver.55*56* @param absoluteAccuracy Absolute accuracy.57*/58publicPegasusSolver(finaldoubleabsoluteAccuracy) { 59super(absoluteAccuracy, Method.PEGASUS); 60 } 61 62/**63* Construct a solver.64*65* @param relativeAccuracy Relative accuracy.66* @param absoluteAccuracy Absolute accuracy.67*/68publicPegasusSolver(finaldoublerelativeAccuracy, 69finaldoubleabsoluteAccuracy) { 70super(relativeAccuracy, absoluteAccuracy, Method.PEGASUS); 71 } 72 73/**74* Construct a solver.75*76* @param relativeAccuracy Relative accuracy.77* @param absoluteAccuracy Absolute accuracy.78* @param functionValueAccuracy Maximum function value error.79*/80publicPegasusSolver(finaldoublerelativeAccuracy, 81finaldoubleabsoluteAccuracy, 82finaldoublefunctionValueAccuracy) { 83super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS); 84 } 85 }