annotate libs/commons-math-2.1/docs/userguide/analysis.html @ 32:d7a43156a79b default tip

new tabs
author dwinter
date Mon, 10 Oct 2011 17:52:22 +0200
parents 5f2c5fb36e93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
2
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
3
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
4
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
5
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
6
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
7
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
8
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
9
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
10
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
11
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
12
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
13 <html xmlns="http://www.w3.org/1999/xhtml">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
14 <head>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
15 <title>Math - The Commons Math User Guide - Numerical Analysis</title>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
16 <style type="text/css" media="all">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
17 @import url("../css/maven-base.css");
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
18 @import url("../css/maven-theme.css");
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
19 @import url("../css/site.css");
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
20 </style>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
21 <link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
22 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
23 </head>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
24 <body class="composite">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
25 <div id="banner">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
26 <span id="bannerLeft">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
27
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
28 Commons Math User Guide
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
29
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
30 </span>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
31 <div class="clear">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
32 <hr/>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
33 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
34 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
35 <div id="breadcrumbs">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
36
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
37
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
38
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
39
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
40
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
41
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
42
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
43
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
44 <div class="xright">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
45
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
46
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
47
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
48
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
49
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
50
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
51
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
52 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
53 <div class="clear">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
54 <hr/>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
55 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
56 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
57 <div id="leftColumn">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
58 <div id="navcolumn">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
59
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
60
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
61
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
62
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
63
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
64
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
65
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
66
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
67 <h5>User Guide</h5>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
68 <ul>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
69
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
70 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
71 <a href="../userguide/index.html">Contents</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
72 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
73
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
74 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
75 <a href="../userguide/overview.html">Overview</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
76 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
77
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
78 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
79 <a href="../userguide/stat.html">Statistics</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
80 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
81
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
82 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
83 <a href="../userguide/random.html">Data Generation</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
84 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
85
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
86 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
87 <a href="../userguide/linear.html">Linear Algebra</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
88 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
89
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
90 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
91 <strong>Numerical Analysis</strong>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
92 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
93
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
94 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
95 <a href="../userguide/special.html">Special Functions</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
96 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
97
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
98 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
99 <a href="../userguide/utilities.html">Utilities</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
100 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
101
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
102 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
103 <a href="../userguide/complex.html">Complex Numbers</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
104 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
105
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
106 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
107 <a href="../userguide/distribution.html">Distributions</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
108 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
109
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
110 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
111 <a href="../userguide/fraction.html">Fractions</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
112 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
113
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
114 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
115 <a href="../userguide/transform.html">Transform Methods</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
116 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
117
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
118 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
119 <a href="../userguide/geometry.html">3D Geometry</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
120 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
121
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
122 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
123 <a href="../userguide/optimization.html">Optimization</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
124 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
125
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
126 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
127 <a href="../userguide/ode.html">Ordinary Differential Equations</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
128 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
129
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
130 <li class="none">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
131 <a href="../userguide/genetics.html">Genetic Algorithms</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
132 </li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
133 </ul>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
134 <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
135 <img alt="Built by Maven" src="../images/logos/maven-feather.png"></img>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
136 </a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
137
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
138
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
139
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
140
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
141
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
142
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
143
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
144
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
145 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
146 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
147 <div id="bodyColumn">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
148 <div id="contentBox">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
149 <div class="section"><h2><a name="a4_Numerical_Analysis"></a>4 Numerical Analysis</h2>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
150 <div class="section"><h3><a name="a4.1_Overview"></a>4.1 Overview</h3>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
151 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
152 The analysis package is the parent package for algorithms dealing with
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
153 real-valued functions of one real variable. It contains dedicated sub-packages
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
154 providing numerical root-finding, integration, and interpolation. It also
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
155 contains a polynomials sub-package that considers polynomials with real
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
156 coefficients as differentiable real functions.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
157 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
158 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
159 Functions interfaces are intended to be implemented by user code to represent
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
160 their domain problems. The algorithms provided by the library will then operate
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
161 on these function to find their roots, or integrate them, or ... Functions can
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
162 be multivariate or univariate, real vectorial or matrix valued, and they can be
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
163 differentiable or not.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
164 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
165 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
166 Possible future additions may include numerical differentiation.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
167 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
168 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
169 <div class="section"><h3><a name="a4.2_Root-finding"></a>4.2 Root-finding</h3>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
170 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
171 A <a href="../apidocs/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
172 org.apache.commons.math.analysis.solvers.UnivariateRealSolver.</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
173 provides the means to find roots of <a href="../apidocs/org/apache/commons/math/analysis/UnivariateRealFunction.html">univariate real-valued functions</a>.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
174 A root is the value where the function takes the value 0. Commons-Math
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
175 includes implementations of the following root-finding algorithms: <ul><li><a href="../apidocs/org/apache/commons/math/analysis/solvers/BisectionSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
176 Bisection</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
177 <li><a href="../apidocs/org/apache/commons/math/analysis/solvers/BrentSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
178 Brent-Dekker</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
179 <li><a href="../apidocs/org/apache/commons/math/analysis/solvers/NewtonSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
180 Newton's Method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
181 <li><a href="../apidocs/org/apache/commons/math/analysis/solvers/SecantSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
182 Secant Method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
183 <li><a href="../apidocs/org/apache/commons/math/analysis/solvers/MullerSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
184 Muller's Method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
185 <li><a href="../apidocs/org/apache/commons/math/analysis/solvers/LaguerreSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
186 Laguerre's Method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
187 <li><a href="../apidocs/org/apache/commons/math/analysis/solvers/RidderSolver.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
188 Ridder's Method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
189 </ul>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
190 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
191 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
192 There are numerous non-obvious traps and pitfalls in root finding.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
193 First, the usual disclaimers due to the way real world computers
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
194 calculate values apply. If the computation of the function provides
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
195 numerical instabilities, for example due to bit cancellation, the root
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
196 finding algorithms may behave badly and fail to converge or even
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
197 return bogus values. There will not necessarily be an indication that
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
198 the computed root is way off the true value. Secondly, the root finding
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
199 problem itself may be inherently ill-conditioned. There is a
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
200 &quot;domain of indeterminacy&quot;, the interval for which the function has
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
201 near zero absolute values around the true root, which may be large.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
202 Even worse, small problems like roundoff error may cause the function
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
203 value to &quot;numerically oscillate&quot; between negative and positive values.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
204 This may again result in roots way off the true value, without
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
205 indication. There is not much a generic algorithm can do if
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
206 ill-conditioned problems are met. A way around this is to transform
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
207 the problem in order to get a better conditioned function. Proper
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
208 selection of a root-finding algorithm and its configuration parameters
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
209 requires knowledge of the analytical properties of the function under
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
210 analysis and numerical analysis techniques. Users are encouraged
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
211 to consult a numerical analysis text (or a numerical analyst) when
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
212 selecting and configuring a solver.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
213 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
214 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
215 In order to use the root-finding features, first a solver object must
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
216 be created. It is encouraged that all solver object creation occurs
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
217 via the <code>org.apache.commons.math.analysis.solvers.UnivariateRealSolverFactory</code>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
218 class. <code>UnivariateRealSolverFactory</code> is a simple factory
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
219 used to create all of the solver objects supported by Commons-Math.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
220 The typical usage of <code>UnivariateRealSolverFactory</code>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
221 to create a solver object would be:</p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
222 <div class="source"><pre>UnivariateRealSolverFactory factory = UnivariateRealSolverFactory.newInstance();
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
223 UnivariateRealSolver solver = factory.newDefaultSolver();</pre>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
224 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
225 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
226 The solvers that can be instantiated via the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
227 <code>UnivariateRealSolverFactory</code> are detailed below:
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
228 <table class="bodyTable"><tr class="a"><th>Solver</th>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
229 <th>Factory Method</th>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
230 <th>Notes on Use</th>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
231 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
232 <tr class="b"><td>Bisection</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
233 <td>newBisectionSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
234 <td><div>Root must be bracketted.</div><div>Linear, guaranteed convergence</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
235 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
236 <tr class="a"><td>Brent</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
237 <td>newBrentSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
238 <td><div>Root must be bracketted.</div><div>Super-linear, guaranteed convergence</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
239 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
240 <tr class="b"><td>Newton</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
241 <td>newNewtonSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
242 <td><div>Uses single value for initialization.</div><div>Super-linear, non-guaranteed convergence</div><div>Function must be differentiable</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
243 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
244 <tr class="a"><td>Secant</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
245 <td>newSecantSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
246 <td><div>Root must be bracketted.</div><div>Super-linear, non-guaranteed convergence</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
247 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
248 <tr class="b"><td>Muller</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
249 <td>newMullerSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
250 <td><div>Root must be bracketted.</div><div>We restrict ourselves to real valued functions, not complex ones</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
251 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
252 <tr class="a"><td>Laguerre</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
253 <td>newLaguerreSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
254 <td><div>Root must be bracketted.</div><div>Function must be a polynomial</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
255 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
256 <tr class="b"><td>Ridder</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
257 <td>newRidderSolver</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
258 <td><div>Root must be bracketted.</div><div></div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
259 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
260 </table>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
261 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
262 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
263 Using a solver object, roots of functions are easily found using the <code>solve</code>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
264 methods. For a function <code>f</code>, and two domain values, <code>min</code> and
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
265 <code>max</code>, <code>solve</code> computes a value <code>c</code> such that:
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
266 <ul><li><code>f(c) = 0.0</code> (see &quot;function value accuracy&quot;)</li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
267 <li><code>min &lt;= c &lt;= max</code></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
268 </ul>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
269 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
270 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
271 Typical usage:
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
272 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
273 <div class="source"><pre>UnivariateRealFunction function = // some user defined function object
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
274 UnivariateRealSolverFactory factory = UnivariateRealSolverFactory.newInstance();
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
275 UnivariateRealSolver solver = factory.newBisectionSolver();
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
276 double c = solver.solve(function, 1.0, 5.0);</pre>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
277 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
278 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
279 The <code>BrentSolve</code> uses the Brent-Dekker algorithm which is
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
280 fast and robust. This algorithm is recommended for most users and the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
281 <code>BrentSolver</code> is the default solver provided by the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
282 <code>UnivariateRealSolverFactory</code>. If there are multiple roots
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
283 in the interval, or there is a large domain of indeterminacy, the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
284 algorithm will converge to a random root in the interval without
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
285 indication that there are problems. Interestingly, the examined text
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
286 book implementations all disagree in details of the convergence
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
287 criteria. Also each implementation had problems for one of the test
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
288 cases, so the expressions had to be fudged further. Don't expect to
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
289 get exactly the same root values as for other implementations of this
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
290 algorithm.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
291 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
292 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
293 The <code>SecantSolver</code> uses a variant of the well known secant
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
294 algorithm. It may be a bit faster than the Brent solver for a class
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
295 of well-behaved functions.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
296 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
297 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
298 The <code>BisectionSolver</code> is included for completeness and for
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
299 establishing a fall back in cases of emergency. The algorithm is
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
300 simple, most likely bug free and guaranteed to converge even in very
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
301 adverse circumstances which might cause other algorithms to
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
302 malfunction. The drawback is of course that it is also guaranteed
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
303 to be slow.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
304 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
305 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
306 The <code>UnivariateRealSolver</code> interface exposes many
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
307 properties to control the convergence of a solver. For the most part,
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
308 these properties should not have to change from their default values
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
309 to produce good results. In the circumstances where changing these
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
310 property values is needed, it is easily done through getter and setter
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
311 methods on <code>UnivariateRealSolver</code>:
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
312 <table class="bodyTable"><tr class="a"><th>Property</th>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
313 <th>Methods</th>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
314 <th>Purpose</th>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
315 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
316 <tr class="b"><td>Absolute accuracy</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
317 <td><div>getAbsoluteAccuracy</div><div>resetAbsoluteAccuracy</div><div>setAbsoluteAccuracy</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
318 <td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
319 The Absolute Accuracy is (estimated) maximal difference between
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
320 the computed root and the true root of the function. This is
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
321 what most people think of as &quot;accuracy&quot; intuitively. The default
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
322 value is chosen as a sane value for most real world problems,
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
323 for roots in the range from -100 to +100. For accurate
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
324 computation of roots near zero, in the range form -0.0001 to
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
325 +0.0001, the value may be decreased. For computing roots
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
326 much larger in absolute value than 100, the default absolute
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
327 accuracy may never be reached because the given relative
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
328 accuracy is reached first.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
329 </td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
330 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
331 <tr class="a"><td>Relative accuracy</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
332 <td><div>getRelativeAccuracy</div><div>resetRelativeAccuracy</div><div>setRelativeAccuracy</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
333 <td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
334 The Relative Accuracy is the maximal difference between the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
335 computed root and the true root, divided by the maximum of the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
336 absolute values of the numbers. This accuracy measurement is
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
337 better suited for numerical calculations with computers, due to
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
338 the way floating point numbers are represented. The default
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
339 value is chosen so that algorithms will get a result even for
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
340 roots with large absolute values, even while it may be
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
341 impossible to reach the given absolute accuracy.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
342 </td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
343 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
344 <tr class="b"><td>Function value accuracy</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
345 <td><div>getFunctionValueAccuracy</div><div>resetFunctionValueAccuracy</div><div>setFunctionValueAccuracy</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
346 <td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
347 This value is used by some algorithms in order to prevent
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
348 numerical instabilities. If the function is evaluated to an
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
349 absolute value smaller than the Function Value Accuracy, the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
350 algorithms assume they hit a root and return the value
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
351 immediately. The default value is a &quot;very small value&quot;. If the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
352 goal is to get a near zero function value rather than an accurate
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
353 root, computation may be sped up by setting this value
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
354 appropriately.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
355 </td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
356 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
357 <tr class="a"><td>Maximum iteration count</td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
358 <td><div>getMaximumIterationCount</div><div>resetMaximumIterationCount</div><div>setMaximumIterationCount</div></td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
359 <td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
360 This is the maximal number of iterations the algorithm will try.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
361 If this number is exceeded, non-convergence is assumed and a
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
362 <code>ConvergenceException</code> exception is thrown. The
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
363 default value is 100, which should be plenty, given that a
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
364 bisection algorithm can't get any more accurate after 52
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
365 iterations because of the number of mantissa bits in a double
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
366 precision floating point number. If a number of ill-conditioned
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
367 problems is to be solved, this number can be decreased in order
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
368 to avoid wasting time.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
369 </td>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
370 </tr>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
371 </table>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
372 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
373 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
374 <div class="section"><h3><a name="a4.3_Interpolation"></a>4.3 Interpolation</h3>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
375 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
376 A <a href="../apidocs/org/apache/commons/math/analysis/interpolation/UnivariateRealInterpolator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
377 org.apache.commons.math.analysis.interpolation.UnivariateRealInterpolator</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
378 is used to find a univariate real-valued function <code>f</code> which
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
379 for a given set of ordered pairs
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
380 (<code>x<sub>i</sub></code>,<code>y<sub>i</sub></code>) yields
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
381 <code>f(x<sub>i</sub>)=y<sub>i</sub></code> to the best accuracy possible. The result
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
382 is provided as an object implementing the <a href="../apidocs/org/apache/commons/math/analysis/UnivariateRealFunction.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
383 org.apache.commons.math.analysis.UnivariateRealFunction</a> interface. It can therefore
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
384 be evaluated at any point, including point not belonging to the original set.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
385 Currently, only an interpolator for generating natural cubic splines and a polynomial
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
386 interpolator are available. There is no interpolator factory, mainly because the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
387 interpolation algorithm is more determined by the kind of the interpolated function
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
388 rather than the set of points to interpolate.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
389 There aren't currently any accuracy controls either, as interpolation
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
390 accuracy is in general determined by the algorithm.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
391 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
392 <p>Typical usage:</p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
393 <div class="source"><pre>double x[] = { 0.0, 1.0, 2.0 };
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
394 double y[] = { 1.0, -1.0, 2.0);
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
395 UnivariateRealInterpolator interpolator = new SplineInterpolator();
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
396 UnivariateRealFunction function = interpolator.interpolate(x, y);
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
397 double interpolationX = 0.5;
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
398 double interpolatedY = function.evaluate(x);
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
399 System.out println(&quot;f(&quot; + interpolationX + &quot;) = &quot; + interpolatedY);</pre>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
400 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
401 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
402 A natural cubic spline is a function consisting of a polynomial of
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
403 third degree for each subinterval determined by the x-coordinates of the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
404 interpolated points. A function interpolating <code>N</code>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
405 value pairs consists of <code>N-1</code> polynomials. The function
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
406 is continuous, smooth and can be differentiated twice. The second
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
407 derivative is continuous but not smooth. The x values passed to the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
408 interpolator must be ordered in ascending order. It is not valid to
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
409 evaluate the function for values outside the range
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
410 <code>x<sub>0</sub></code>..<code>x<sub>N</sub></code>.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
411 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
412 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
413 The polynomial function returned by the Neville's algorithm is a single
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
414 polynomial guaranteed to pass exactly through the interpolation points.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
415 The degree of the polynomial is the number of points minus 1 (i.e. the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
416 interpolation polynomial for a three points set will be a quadratic
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
417 polynomial). Despite the fact the interpolating polynomials is a perfect
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
418 approximation of a function at interpolation points, it may be a loose
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
419 approximation between the points. Due to <a href="http://en.wikipedia.org/wiki/Runge's_phenomenon" class="externalLink">Runge's phenomenom</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
420 the error can get worse as the degree of the polynomial increases, so
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
421 adding more points does not always lead to a better interpolation.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
422 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
423 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
424 Loess (or Lowess) interpolation is a robust interpolation useful for
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
425 smoothing univariate scaterplots. It has been described by William
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
426 Cleveland in his 1979 seminal paper <a href="http://www.math.tau.ac.il/~yekutiel/MA%20seminar/Cleveland%201979.pdf" class="externalLink">Robust
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
427 Locally Weighted Regression and Smoothing Scatterplots</a>. This kind of
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
428 interpolation is computationally intensive but robust.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
429 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
430 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
431 Microsphere interpolation is a robust multidimensional interpolation algorithm.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
432 It has been described in William Dudziak's <a href="http://www.dudziak.com/microsphere.pdf" class="externalLink">MS thesis</a>.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
433 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
434 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
435 A <a href="../apidocs/org/apache/commons/math/analysis/interpolation/BivariateRealGridInterpolator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
436 org.apache.commons.math.analysis.interpolation.BivariateRealGridInterpolator</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
437 is used to find a bivariate real-valued function <code>f</code> which
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
438 for a given set of tuples
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
439 (<code>x<sub>i</sub></code>,<code>y<sub>j</sub></code>,<code>z<sub>ij</sub></code>)
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
440 yields <code>f(x<sub>i</sub>,y<sub>j</sub>)=z<sub>ij</sub></code> to the best accuracy
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
441 possible. The result is provided as an object implementing the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
442 <a href="../apidocs/org/apache/commons/math/analysis/BivariateRealFunction.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
443 org.apache.commons.math.analysis.BivariateRealFunction</a> interface. It can therefore
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
444 be evaluated at any point, including a point not belonging to the original set.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
445 The array <code>x<sub>i</sub></code> and <code>y<sub>j</sub></code> must be sorted in
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
446 increasing order in order to define a two-dimensional regular grid.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
447 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
448 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
449 In <a href="../apidocs/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
450 bicubic interpolation</a>, the interpolation function is a 3rd-degree polynomial of two
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
451 variables. The coefficients are computed from the function values sampled on a regular grid,
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
452 as well as the values of the partial derivatives of the function at those grid points.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
453 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
454 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
455 From two-dimensional data sampled on a regular grid, the
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
456 <a href="../apidocs/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
457 org.apache.commons.math.analysis.interpolation.SmoothingBicubicSplineInterpolator</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
458 computes a <a href="../apidocs/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
459 bicubic interpolating function</a>. The data is first smoothed, along each grid dimension,
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
460 using one-dimensional splines.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
461 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
462 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
463 <div class="section"><h3><a name="a4.4_Integration"></a>4.4 Integration</h3>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
464 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
465 A <a href="../apidocs/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
466 org.apache.commons.math.analysis.integration.UnivariateRealIntegrator.</a>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
467 provides the means to numerically integrate <a href="../apidocs/org/apache/commons/math/analysis/UnivariateRealFunction.html">univariate real-valued functions</a>.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
468 Commons-Math includes implementations of the following integration algorithms: <ul><li><a href="../apidocs/org/apache/commons/math/analysis/integration/RombergIntegrator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
469 Romberg's method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
470 <li><a href="../apidocs/org/apache/commons/math/analysis/integration/SimpsonIntegrator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
471 Simpson's method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
472 <li><a href="../apidocs/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
473 trapezoid method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
474 <li><a href="../apidocs/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
475 Legendre-Gauss method</a></li>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
476 </ul>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
477 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
478 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
479 <div class="section"><h3><a name="a4.5_Polynomials"></a>4.5 Polynomials</h3>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
480 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
481 The <a href="../apidocs/org/apache/commons/math/analysis/polynomials/package-summary.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
482 org.apache.commons.math.analysis.polynomials</a> package provides real coefficients
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
483 polynomials.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
484 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
485 <p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
486 The <a href="../apidocs/org/apache/commons/math/analysis/polynomials/PolynomialFunction.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
487 org.apache.commons.math.analysis.polynomials.PolynomialFunction</a> class is the most general
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
488 one, using traditional coefficients arrays. The <a href="../apidocs/org/apache/commons/math/analysis/polynomials/PolynomialsUtils.html">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
489 org.apache.commons.math.analysis.polynomials.PolynomialsUtils</a> utility class provides static
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
490 factory methods to build Chebyshev, Hermite, Lagrange and Legendre polynomials. Coefficients
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
491 are computed using exact fractions so these factory methods can build polynomials up to any degree.
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
492 </p>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
493 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
494 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
495
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
496 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
497 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
498 <div class="clear">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
499 <hr/>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
500 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
501 <div id="footer">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
502 <div class="xright">&#169;
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
503 2003-2010
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
504
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
505
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
506
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
507
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
508
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
509
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
510
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
511
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
512
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
513 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
514 <div class="clear">
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
515 <hr/>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
516 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
517 </div>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
518 </body>
5f2c5fb36e93 commons-math-2.1 added
dwinter
parents:
diff changeset
519 </html>