| <!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>UnivariateFunction (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="UnivariateFunction (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/UnivariateFunction.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/TrivariateFunction.html" title="interface in org.apache.commons.math3.analysis"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/commons/math3/analysis/UnivariateMatrixFunction.html" title="interface in org.apache.commons.math3.analysis"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/commons/math3/analysis/UnivariateFunction.html" target="_top">Frames</a></li> |
| <li><a href="UnivariateFunction.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: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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</div> |
| <h2 title="Interface UnivariateFunction" class="title">Interface UnivariateFunction</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Known Subinterfaces:</dt> |
| <dd><a href="../../../../../org/apache/commons/math3/analysis/DifferentiableUnivariateFunction.html" title="interface in org.apache.commons.math3.analysis">DifferentiableUnivariateFunction</a>, <a href="../../../../../org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.html" title="interface in org.apache.commons.math3.analysis.differentiation">UnivariateDifferentiableFunction</a></dd> |
| </dl> |
| <dl> |
| <dt>All Known Implementing Classes:</dt> |
| <dd><a href="../../../../../org/apache/commons/math3/analysis/function/Abs.html" title="class in org.apache.commons.math3.analysis.function">Abs</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Acos.html" title="class in org.apache.commons.math3.analysis.function">Acos</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Acosh.html" title="class in org.apache.commons.math3.analysis.function">Acosh</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Asin.html" title="class in org.apache.commons.math3.analysis.function">Asin</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Asinh.html" title="class in org.apache.commons.math3.analysis.function">Asinh</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Atan.html" title="class in org.apache.commons.math3.analysis.function">Atan</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Atanh.html" title="class in org.apache.commons.math3.analysis.function">Atanh</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Cbrt.html" title="class in org.apache.commons.math3.analysis.function">Cbrt</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Ceil.html" title="class in org.apache.commons.math3.analysis.function">Ceil</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Constant.html" title="class in org.apache.commons.math3.analysis.function">Constant</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Cos.html" title="class in org.apache.commons.math3.analysis.function">Cos</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Cosh.html" title="class in org.apache.commons.math3.analysis.function">Cosh</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Exp.html" title="class in org.apache.commons.math3.analysis.function">Exp</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Expm1.html" title="class in org.apache.commons.math3.analysis.function">Expm1</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Floor.html" title="class in org.apache.commons.math3.analysis.function">Floor</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Gaussian.html" title="class in org.apache.commons.math3.analysis.function">Gaussian</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/HarmonicOscillator.html" title="class in org.apache.commons.math3.analysis.function">HarmonicOscillator</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Identity.html" title="class in org.apache.commons.math3.analysis.function">Identity</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Inverse.html" title="class in org.apache.commons.math3.analysis.function">Inverse</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Log.html" title="class in org.apache.commons.math3.analysis.function">Log</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Log10.html" title="class in org.apache.commons.math3.analysis.function">Log10</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Log1p.html" title="class in org.apache.commons.math3.analysis.function">Log1p</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Logistic.html" title="class in org.apache.commons.math3.analysis.function">Logistic</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Logit.html" title="class in org.apache.commons.math3.analysis.function">Logit</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Minus.html" title="class in org.apache.commons.math3.analysis.function">Minus</a>, <a href="../../../../../org/apache/commons/math3/analysis/polynomials/PolynomialFunction.html" title="class in org.apache.commons.math3.analysis.polynomials">PolynomialFunction</a>, <a href="../../../../../org/apache/commons/math3/analysis/polynomials/PolynomialFunctionLagrangeForm.html" title="class in org.apache.commons.math3.analysis.polynomials">PolynomialFunctionLagrangeForm</a>, <a href="../../../../../org/apache/commons/math3/analysis/polynomials/PolynomialFunctionNewtonForm.html" title="class in org.apache.commons.math3.analysis.polynomials">PolynomialFunctionNewtonForm</a>, <a href="../../../../../org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunction.html" title="class in org.apache.commons.math3.analysis.polynomials">PolynomialSplineFunction</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Power.html" title="class in org.apache.commons.math3.analysis.function">Power</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Rint.html" title="class in org.apache.commons.math3.analysis.function">Rint</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Sigmoid.html" title="class in org.apache.commons.math3.analysis.function">Sigmoid</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Signum.html" title="class in org.apache.commons.math3.analysis.function">Signum</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Sin.html" title="class in org.apache.commons.math3.analysis.function">Sin</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Sinc.html" title="class in org.apache.commons.math3.analysis.function">Sinc</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Sinh.html" title="class in org.apache.commons.math3.analysis.function">Sinh</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Sqrt.html" title="class in org.apache.commons.math3.analysis.function">Sqrt</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/StepFunction.html" title="class in org.apache.commons.math3.analysis.function">StepFunction</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Tan.html" title="class in org.apache.commons.math3.analysis.function">Tan</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Tanh.html" title="class in org.apache.commons.math3.analysis.function">Tanh</a>, <a href="../../../../../org/apache/commons/math3/analysis/function/Ulp.html" title="class in org.apache.commons.math3.analysis.function">Ulp</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="strong">UnivariateFunction</span></pre> |
| <div class="block">An interface representing a univariate real function. |
| <br/> |
| When a <em>user-defined</em> function encounters an error during |
| evaluation, the <a href="../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html#value(double)"><code>value</code></a> method should throw a |
| <em>user-defined</em> unchecked exception. |
| <br/> |
| The following code excerpt shows the recommended way to do that using |
| a root solver as an example, but the same construct is applicable to |
| ODE integrators or optimizers. |
| |
| <pre> |
| private static class LocalException extends RuntimeException { |
| // The x value that caused the problem. |
| private final double x; |
| |
| public LocalException(double x) { |
| this.x = x; |
| } |
| |
| public double getX() { |
| return x; |
| } |
| } |
| |
| private static class MyFunction implements UnivariateFunction { |
| public double value(double x) { |
| double y = hugeFormula(x); |
| if (somethingBadHappens) { |
| throw new LocalException(x); |
| } |
| return y; |
| } |
| } |
| |
| public void compute() { |
| try { |
| solver.solve(maxEval, new MyFunction(a, b, c), min, max); |
| } catch (LocalException le) { |
| // Retrieve the x value. |
| } |
| } |
| </pre> |
| |
| As shown, the exception is local to the user's code and it is guaranteed |
| that Apache Commons Math will not catch it.</div> |
| <dl><dt><span class="strong">Version:</span></dt> |
| <dd>$Id: UnivariateFunction.java 1364387 2012-07-22 18:14:11Z tn $</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"> </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>double</code></td> |
| <td class="colLast"><code><strong><a href="../../../../../org/apache/commons/math3/analysis/UnivariateFunction.html#value(double)">value</a></strong>(double x)</code> |
| <div class="block">Compute the value of the function.</div> |
| </td> |
| </tr> |
| </table> |
| </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="value(double)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>value</h4> |
| <pre>double value(double x)</pre> |
| <div class="block">Compute the value of the function.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>x</code> - Point at which the function value should be computed.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>the value of the function.</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - when the activated method itself can |
| ascertain that a precondition, specified in the API expressed at the |
| level of the activated method, has been violated. |
| When Commons Math throws an <code>IllegalArgumentException</code>, it is |
| usually the consequence of checking the actual parameters passed to |
| the method.</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/UnivariateFunction.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/TrivariateFunction.html" title="interface in org.apache.commons.math3.analysis"><span class="strong">Prev Class</span></a></li> |
| <li><a href="../../../../../org/apache/commons/math3/analysis/UnivariateMatrixFunction.html" title="interface in org.apache.commons.math3.analysis"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../../index.html?org/apache/commons/math3/analysis/UnivariateFunction.html" target="_top">Frames</a></li> |
| <li><a href="UnivariateFunction.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: </li> |
| <li>Nested | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method_summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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 © 2003–2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |