commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [math] Fit function to data set
Date Tue, 03 Jul 2012 22:52:56 GMT
On Tue, Jul 03, 2012 at 07:09:30PM -0300, Italo Maia wrote:
> >
> > Did you have a look at the classes in the package
> > "org.apache.commons.math3.optimization" ?
> >
> 
> No, I did not. Let's see...
> 
> Which function?
> >
> 
> This little devil:
> 
> http://dpaste.com/hold/767050/
> 
> *public static double fnc(double t, double a, double b, double c){
>         return Math.log(a) + b * Math.log(t) - c * t;
> }*
> 
> I have *t* in the matrix (first column). Second column are the observed
> values. I need to fit a, b and c.

What you are looking for is probably the "CurveFitter" class (in package
"org.apache.commons.math3.optimization.fitting").

Your function must implement the "ParametricUnivariateFunction" interface
(defined in package "org.apache.commons.math3.analysis").

The optimizers you can use are located in package
"org.apache.commons.math3.optimization.general". [Try the
"LevengergMarquardt" class (using the default constructor).]


HTH,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message