﻿MultiVariableFunctionFitter(M) Class
Class MultiVariableFunctionFitter fits a generalized multivariable function to a set of points.

Namespace: CenterSpace.NMath.Analysis
Assembly: NMathPremium (in NMathPremium.dll) Version: 5.3.0.0

# Syntax

C#
```[SerializableAttribute]
public class MultiVariableFunctionFitter<M> : ICloneable
where M : new(), INonlinearLeastSqMinimizer
```
Visual Basic
```<SerializableAttribute> _
Public Class MultiVariableFunctionFitter(Of M As {New, INonlinearLeastSqMinimizer}) _
Implements ICloneable```
Visual C++
```[SerializableAttribute]
generic<typename M>
where M : gcnew(), INonlinearLeastSqMinimizer
public ref class MultiVariableFunctionFitter : ICloneable```

# Type Parameters

M

[Missing <typeparam name="M"/> documentation for "T:CenterSpace.NMath.Analysis.MultiVariableFunctionFitter`1"]

# Remarks

In the space of the function parameters, begining at a specified starting point, finds a minimum (possibly local) in the sum of the squared residuals with respect to a set of data points. You must supply at least as many data points to fit as your function has parameters.
For example, the following code fits a function of the form data to the following function:
```            F(p, x) = p[0]x[0]x[1]^2 + p[1]sin(x[0]) + p[2]x[1]^3;
```
to a set of 10 data points, beginning at point (10, 10, 10) in the parameter space.
Copy
```DoubleMatrix x = new DoubleMatrix(10, 2);
x[Slice.All, 0] = new DoubleVector("3.6 7.7 9.3 4.1 8.6 2.8 1.3 7.9 10.0 5.4");
x[Slice.All, 1] = new DoubleVector("16.5 150.6 263.1 24.7 208.5 9.9 2.7 163.9 325.0 54.3");

DoubleVector yValues = new DoubleVector("95.09 23.11 60.63 48.59 89.12 76.97 45.68 1.84 82.17 44.47");
DoubleVector initial_parameters = new DoubleVector("10 10 10");

Func<DoubleVector, DoubleVector, double> f = delegate(DoubleVector p, DoubleVector xdata)
{
return Math.Pow(p[0] * xdata[0] * xdata[1], 2.0) + p[1] * Math.Sin(xdata[0]) + Math.Pow(p[2] * xdata[1], 3.0);
};

MultiVariableFunctionFitter<TrustRegionMinimizer> fitter = new MultiVariableFunctionFitter<TrustRegionMinimizer>(f);
DoubleVector solution = fitter.Fit(x, yValues, initial_parameters);```
Note that problems can have multiple local minima. Trying different initial parameter points is recommended for better solutions.

# Inheritance Hierarchy

System..::..Object
CenterSpace.NMath.Analysis..::..MultiVariableFunctionFitter<(Of <(<'M>)>)>
CenterSpace.NMath.Analysis..::..BoundedMultiVariableFunctionFitter<(Of <(<'M>)>)>