File: Scientific_9.html

package info (click to toggle)
python-scientific 2.2-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,368 kB
  • ctags: 2,396
  • sloc: python: 6,468; ansic: 3,643; xml: 3,596; makefile: 79; sh: 27
file content (49 lines) | stat: -rw-r--r-- 1,996 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<a name="Module:Scientific.Functions.LeastSquares"><h1>Module Scientific.Functions.LeastSquares</h1></a>

<hr width=70%>
<h2>Functions</h2>

<ul>
<li> <p>

<a name="Function:Scientific.Functions.LeastSquares.leastSquaresFit"><b><i>leastSquaresFit</i></b>(<i>model</i>, <i>parameters</i>, <i>data</i>)</a><br>


</p>

<p>General non-linear least-squares fit using the
Levenberg-Marquardt algorithm and automatic derivatives.</p>

<p>The parameter <i>model</i> specifies the function to be fitted. It will be
called with two parameters: the first is a tuple containing all fit
parameters, and the second is the first element of a data point (see
below). The return value must be a number.  Since automatic
differentiation is used to obtain the derivatives with respect to the
parameters, the function may only use the mathematical functions known
to the module FirstDerivatives.</p>

<p>The parameter <i>parameter</i> is a tuple of initial values for the
fit parameters.</p>

<p>The parameter <i>data</i> is a list of data points to which the model
is to be fitted. Each data point is a tuple of length two or
three. Its first element specifies the independent variables
of the model. It is passed to the model function as its first
parameter, but not used in any other way. The second element
of each data point tuple is the number that the return value
of the model function is supposed to match as well as possible.
The third element (which defaults to 1.) is the statistical
variance of the data point, i.e. the inverse of its statistical
weight in the fitting procedure.</p>

<p>The function returns a list containing the optimal parameter values
and the chi-squared value describing the quality of the fit.
</p><li> <p>

<a name="Function:Scientific.Functions.LeastSquares.polynomialLeastSquaresFit"><b><i>polynomialLeastSquaresFit</i></b>(<i>parameters</i>, <i>data</i>)</a><br>


</p>

<p>Least-squares fit to a polynomial whose order is defined by
the number of parameter values.</p></ul>