blob: b5e43dbdae1a17dfcc941fb7b9a060f1cac35bc9 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>UnivariateSolverUtils (Apache Commons Math 3.3 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="UnivariateSolverUtils (Apache Commons Math 3.3 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/UnivariateSolverUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolver.html" title="interface in org.apache.commons.math3.analysis.solvers"><span class="strong">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html" target="_top">Frames</a></li>
<li><a href="UnivariateSolverUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.commons.math3.analysis.solvers</div>
<h2 title="Class UnivariateSolverUtils" class="title">Class UnivariateSolverUtils</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">UnivariateSolverUtils</span>
extends <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Utility routines for <a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolver.html" title="interface in org.apache.commons.math3.analysis.solvers"><code>UnivariateSolver</code></a> objects.</div>
<dl><dt><span class="strong">Version:</span></dt>
<dd>$Id: UnivariateSolverUtils.java 1579346 2014-03-19 18:43:39Z erans $</dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double)">bracket</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;initial,
double&nbsp;lowerBound,
double&nbsp;upperBound)</code>
<div class="block">This method simply calls <a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)"><code>bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)</code></a>
with <code>q</code> and <code>r</code> set to 1.0 and <code>maximumIterations</code> set to <code>Integer.MAX_VALUE</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)">bracket</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;initial,
double&nbsp;lowerBound,
double&nbsp;upperBound,
double&nbsp;q,
double&nbsp;r,
int&nbsp;maximumIterations)</code>
<div class="block">This method attempts to find two values a and b satisfying
<code>lowerBound &lt;= a &lt; initial &lt; b &lt;= upperBound</code>
<code>f(a) * f(b) &lt;= 0</code>
If <code>f</code> is continuous on <code>[a,b]</code>, this means that <code>a</code>
and <code>b</code> bracket a root of <code>f</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double[]</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, int)">bracket</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;initial,
double&nbsp;lowerBound,
double&nbsp;upperBound,
int&nbsp;maximumIterations)</code>
<div class="block">This method simply calls <a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)"><code>bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)</code></a>
with <code>q</code> and <code>r</code> set to 1.0.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#forceSide(int, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.solvers.BracketedUnivariateSolver, double, double, double, org.apache.commons.math3.analysis.solvers.AllowedSolution)">forceSide</a></strong>(int&nbsp;maxEval,
<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;f,
<a href="../../../../../../org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.html" title="interface in org.apache.commons.math3.analysis.solvers">BracketedUnivariateSolver</a>&lt;<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&gt;&nbsp;bracketing,
double&nbsp;baseRoot,
double&nbsp;min,
double&nbsp;max,
<a href="../../../../../../org/apache/commons/math3/analysis/solvers/AllowedSolution.html" title="enum in org.apache.commons.math3.analysis.solvers">AllowedSolution</a>&nbsp;allowedSolution)</code>
<div class="block">Force a root found by a non-bracketing solver to lie on a specified side,
as if the solver was a bracketing one.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#isBracketing(org.apache.commons.math3.analysis.UnivariateFunction, double, double)">isBracketing</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;lower,
double&nbsp;upper)</code>
<div class="block">Check whether the interval bounds bracket a root.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#isSequence(double, double, double)">isSequence</a></strong>(double&nbsp;start,
double&nbsp;mid,
double&nbsp;end)</code>
<div class="block">Check whether the arguments form a (strictly) increasing sequence.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#midpoint(double, double)">midpoint</a></strong>(double&nbsp;a,
double&nbsp;b)</code>
<div class="block">Compute the midpoint of two values.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#solve(org.apache.commons.math3.analysis.UnivariateFunction, double, double)">solve</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;x0,
double&nbsp;x1)</code>
<div class="block">Convenience method to find a zero of a univariate real function.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#solve(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double)">solve</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;x0,
double&nbsp;x1,
double&nbsp;absoluteAccuracy)</code>
<div class="block">Convenience method to find a zero of a univariate real function.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#verifyBracketing(org.apache.commons.math3.analysis.UnivariateFunction, double, double)">verifyBracketing</a></strong>(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;lower,
double&nbsp;upper)</code>
<div class="block">Check that the endpoints specify an interval and the end points
bracket a root.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#verifyInterval(double, double)">verifyInterval</a></strong>(double&nbsp;lower,
double&nbsp;upper)</code>
<div class="block">Check that the endpoints specify an interval.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#verifySequence(double, double, double)">verifySequence</a></strong>(double&nbsp;lower,
double&nbsp;initial,
double&nbsp;upper)</code>
<div class="block">Check that <code>lower &lt; initial &lt; upper</code>.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="solve(org.apache.commons.math3.analysis.UnivariateFunction, double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>solve</h4>
<pre>public static&nbsp;double&nbsp;solve(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;x0,
double&nbsp;x1)
throws <a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">Convenience method to find a zero of a univariate real function. A default
solver is used.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - Function.</dd><dd><code>x0</code> - Lower bound for the interval.</dd><dd><code>x1</code> - Upper bound for the interval.</dd>
<dt><span class="strong">Returns:</span></dt><dd>a value where the function is zero.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if the function has the same sign at the
endpoints.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>function</code> is <code>null</code>.</dd></dl>
</li>
</ul>
<a name="solve(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>solve</h4>
<pre>public static&nbsp;double&nbsp;solve(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;x0,
double&nbsp;x1,
double&nbsp;absoluteAccuracy)
throws <a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">Convenience method to find a zero of a univariate real function. A default
solver is used.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - Function.</dd><dd><code>x0</code> - Lower bound for the interval.</dd><dd><code>x1</code> - Upper bound for the interval.</dd><dd><code>absoluteAccuracy</code> - Accuracy to be used by the solver.</dd>
<dt><span class="strong">Returns:</span></dt><dd>a value where the function is zero.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if the function has the same sign at the
endpoints.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>function</code> is <code>null</code>.</dd></dl>
</li>
</ul>
<a name="forceSide(int, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.solvers.BracketedUnivariateSolver, double, double, double, org.apache.commons.math3.analysis.solvers.AllowedSolution)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>forceSide</h4>
<pre>public static&nbsp;double&nbsp;forceSide(int&nbsp;maxEval,
<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;f,
<a href="../../../../../../org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.html" title="interface in org.apache.commons.math3.analysis.solvers">BracketedUnivariateSolver</a>&lt;<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&gt;&nbsp;bracketing,
double&nbsp;baseRoot,
double&nbsp;min,
double&nbsp;max,
<a href="../../../../../../org/apache/commons/math3/analysis/solvers/AllowedSolution.html" title="enum in org.apache.commons.math3.analysis.solvers">AllowedSolution</a>&nbsp;allowedSolution)
throws <a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">Force a root found by a non-bracketing solver to lie on a specified side,
as if the solver was a bracketing one.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>maxEval</code> - maximal number of new evaluations of the function
(evaluations already done for finding the root should have already been subtracted
from this number)</dd><dd><code>f</code> - function to solve</dd><dd><code>bracketing</code> - bracketing solver to use for shifting the root</dd><dd><code>baseRoot</code> - original root found by a previous non-bracketing solver</dd><dd><code>min</code> - minimal bound of the search interval</dd><dd><code>max</code> - maximal bound of the search interval</dd><dd><code>allowedSolution</code> - the kind of solutions that the root-finding algorithm may
accept as solutions.</dd>
<dt><span class="strong">Returns:</span></dt><dd>a root approximation, on the specified side of the exact root</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if the function has the same sign at the
endpoints.</dd></dl>
</li>
</ul>
<a name="bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bracket</h4>
<pre>public static&nbsp;double[]&nbsp;bracket(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;initial,
double&nbsp;lowerBound,
double&nbsp;upperBound)
throws <a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">This method simply calls <a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)"><code>bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)</code></a>
with <code>q</code> and <code>r</code> set to 1.0 and <code>maximumIterations</code> set to <code>Integer.MAX_VALUE</code>.
<strong>Note: </strong> this method can take
<code>Integer.MAX_VALUE</code> iterations to throw a
<code>ConvergenceException.</code> Unless you are confident that there
is a root between <code>lowerBound</code> and <code>upperBound</code>
near <code>initial,</code> it is better to use
<a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)"><code>bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)</code></a>,
explicitly specifying the maximum number of iterations.</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - Function.</dd><dd><code>initial</code> - Initial midpoint of interval being expanded to
bracket a root.</dd><dd><code>lowerBound</code> - Lower bound (a is never lower than this value)</dd><dd><code>upperBound</code> - Upper bound (b never is greater than this
value).</dd>
<dt><span class="strong">Returns:</span></dt><dd>a two-element array holding a and b.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if a root cannot be bracketted.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</a></code> - if <code>maximumIterations &lt;= 0</code>.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>function</code> is <code>null</code>.</dd></dl>
</li>
</ul>
<a name="bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bracket</h4>
<pre>public static&nbsp;double[]&nbsp;bracket(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;initial,
double&nbsp;lowerBound,
double&nbsp;upperBound,
int&nbsp;maximumIterations)
throws <a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">This method simply calls <a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html#bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)"><code>bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)</code></a>
with <code>q</code> and <code>r</code> set to 1.0.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - Function.</dd><dd><code>initial</code> - Initial midpoint of interval being expanded to
bracket a root.</dd><dd><code>lowerBound</code> - Lower bound (a is never lower than this value).</dd><dd><code>upperBound</code> - Upper bound (b never is greater than this
value).</dd><dd><code>maximumIterations</code> - Maximum number of iterations to perform</dd>
<dt><span class="strong">Returns:</span></dt><dd>a two element array holding a and b.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if the algorithm fails to find a and b
satisfying the desired conditions.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NotStrictlyPositiveException.html" title="class in org.apache.commons.math3.exception">NotStrictlyPositiveException</a></code> - if <code>maximumIterations &lt;= 0</code>.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>function</code> is <code>null</code>.</dd></dl>
</li>
</ul>
<a name="bracket(org.apache.commons.math3.analysis.UnivariateFunction, double, double, double, double, double, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bracket</h4>
<pre>public static&nbsp;double[]&nbsp;bracket(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;initial,
double&nbsp;lowerBound,
double&nbsp;upperBound,
double&nbsp;q,
double&nbsp;r,
int&nbsp;maximumIterations)
throws <a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">This method attempts to find two values a and b satisfying <ul>
<li> <code>lowerBound &lt;= a &lt; initial &lt; b &lt;= upperBound</code> </li>
<li> <code>f(a) * f(b) &lt;= 0</code> </li>
</ul>
If <code>f</code> is continuous on <code>[a,b]</code>, this means that <code>a</code>
and <code>b</code> bracket a root of <code>f</code>.
<p>
The algorithm checks the sign of \( f(l_k) \) and \( f(u_k) \) for increasing
values of k, where \( l_k = max(lower, initial - \delta_k) \),
\( u_k = min(upper, initial + \delta_k) \), using recurrence
\( \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>
<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> <code>maximumIterations</code> iterations elapse -- NoBracketingException </li></ul></p>
<p>
If different signs are found at first iteration (<code>k=1</code>), then the returned
interval will be \( [a, b] = [l_1, u_1] \). If different signs are found at a later
iteration ({code k>1}, then the returned interval will be either
\( [a, b] = [l_{k+1}, l_{k}] \) or ( [a, b] = [u_{k}, u_{k+1}] \). A root solver called
with these parameters will therefore start with the smallest bracketing interval known
at this step.
</p>
<p>
Interval expansion rate is tuned by changing the recurrence parameters <code>r</code> and
<code>q</code>. When the multiplicative factor <code>r</code> is set to 1, the sequence is a
simple arithmetic sequence with linear increase. When the multiplicative factor <code>r</code>
is larger than 1, the sequence has an asymtotically exponential rate. Note than the
additive parameter <code>q</code> should never be set to zero, otherwise the interval would
degenerate to the single initial point for all values of <code>k</code>.
</p>
<p>
As a rule of thumb, when the location of the root is expected to be approximately known
within some error margin, <code>r</code> should be set to 1 and <code>q</code> should be set to the
order of magnitude of the error margin. When the location of the root is really a wild guess,
then <code>r</code> should be set to a value larger than 1 (typically 2 to double the interval
length at each iteration) and <code>q</code> should be set according to half the initial
search interval length.
</p>
<p>
As an example, if we consider the trivial function <code>f(x) = 1 - x</code> and use
<code>initial = 4</code>, <code>r = 1</code>, <code>q = 2</code>, the algorithm will compute
<code>f(4-2) = f(2) = -1</code> and <code>f(4+2) = f(6) = -5</code> for <code>k = 1</code>, then
<code>f(4-4) = f(0) = +1</code> and <code>f(4+4) = f(8) = -7</code> for <code>k = 2</code>. Then it will
return the interval <code>[0, 2]</code> as the smallest one known to be bracketing the root.
As shown by this example, the initial value (here <code>4</code>) may lie outside of the returned
bracketing interval.
</p></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - function to check</dd><dd><code>initial</code> - Initial midpoint of interval being expanded to
bracket a root.</dd><dd><code>lowerBound</code> - Lower bound (a is never lower than this value).</dd><dd><code>upperBound</code> - Upper bound (b never is greater than this
value).</dd><dd><code>q</code> - additive offset used to compute bounds sequence (must be strictly positive)</dd><dd><code>r</code> - multiplicative factor used to compute bounds sequence</dd><dd><code>maximumIterations</code> - Maximum number of iterations to perform</dd>
<dt><span class="strong">Returns:</span></dt><dd>a two element array holding the bracketing values.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if function cannot be bracketed in the search interval</dd></dl>
</li>
</ul>
<a name="midpoint(double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>midpoint</h4>
<pre>public static&nbsp;double&nbsp;midpoint(double&nbsp;a,
double&nbsp;b)</pre>
<div class="block">Compute the midpoint of two values.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>a</code> - first value.</dd><dd><code>b</code> - second value.</dd>
<dt><span class="strong">Returns:</span></dt><dd>the midpoint.</dd></dl>
</li>
</ul>
<a name="isBracketing(org.apache.commons.math3.analysis.UnivariateFunction, double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isBracketing</h4>
<pre>public static&nbsp;boolean&nbsp;isBracketing(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;lower,
double&nbsp;upper)
throws <a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></pre>
<div class="block">Check whether the interval bounds bracket a root. That is, if the
values at the endpoints are not equal to zero, then the function takes
opposite signs at the endpoints.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - Function.</dd><dd><code>lower</code> - Lower endpoint.</dd><dd><code>upper</code> - Upper endpoint.</dd>
<dt><span class="strong">Returns:</span></dt><dd><code>true</code> if the function values have opposite signs at the
given points.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>function</code> is <code>null</code>.</dd></dl>
</li>
</ul>
<a name="isSequence(double, double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isSequence</h4>
<pre>public static&nbsp;boolean&nbsp;isSequence(double&nbsp;start,
double&nbsp;mid,
double&nbsp;end)</pre>
<div class="block">Check whether the arguments form a (strictly) increasing sequence.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>start</code> - First number.</dd><dd><code>mid</code> - Second number.</dd><dd><code>end</code> - Third number.</dd>
<dt><span class="strong">Returns:</span></dt><dd><code>true</code> if the arguments form an increasing sequence.</dd></dl>
</li>
</ul>
<a name="verifyInterval(double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>verifyInterval</h4>
<pre>public static&nbsp;void&nbsp;verifyInterval(double&nbsp;lower,
double&nbsp;upper)
throws <a href="../../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</a></pre>
<div class="block">Check that the endpoints specify an interval.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>lower</code> - Lower endpoint.</dd><dd><code>upper</code> - Upper endpoint.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</a></code> - if <code>lower &gt;= upper</code>.</dd></dl>
</li>
</ul>
<a name="verifySequence(double, double, double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>verifySequence</h4>
<pre>public static&nbsp;void&nbsp;verifySequence(double&nbsp;lower,
double&nbsp;initial,
double&nbsp;upper)
throws <a href="../../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</a></pre>
<div class="block">Check that <code>lower &lt; initial &lt; upper</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>lower</code> - Lower endpoint.</dd><dd><code>initial</code> - Initial value.</dd><dd><code>upper</code> - Upper endpoint.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NumberIsTooLargeException.html" title="class in org.apache.commons.math3.exception">NumberIsTooLargeException</a></code> - if <code>lower &gt;= initial</code> or
<code>initial &gt;= upper</code>.</dd></dl>
</li>
</ul>
<a name="verifyBracketing(org.apache.commons.math3.analysis.UnivariateFunction, double, double)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>verifyBracketing</h4>
<pre>public static&nbsp;void&nbsp;verifyBracketing(<a href="../../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">UnivariateFunction</a>&nbsp;function,
double&nbsp;lower,
double&nbsp;upper)
throws <a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a>,
<a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></pre>
<div class="block">Check that the endpoints specify an interval and the end points
bracket a root.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>function</code> - Function.</dd><dd><code>lower</code> - Lower endpoint.</dd><dd><code>upper</code> - Upper endpoint.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NoBracketingException.html" title="class in org.apache.commons.math3.exception">NoBracketingException</a></code> - if the function has the same sign at the
endpoints.</dd>
<dd><code><a href="../../../../../../org/apache/commons/math3/exception/NullArgumentException.html" title="class in org.apache.commons.math3.exception">NullArgumentException</a></code> - if <code>function</code> is <code>null</code>.</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/UnivariateSolverUtils.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/analysis/solvers/UnivariateSolver.html" title="interface in org.apache.commons.math3.analysis.solvers"><span class="strong">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.html" target="_top">Frames</a></li>
<li><a href="UnivariateSolverUtils.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2003&#x2013;2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>