Some "context" below:
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.
=== END
Well, the derivatives don't seem to be working.
double da = 1/a;
double db = b/t;
double dc = -c;
> Date: Thu, 5 Jul 2012 19:21:46 +0200
> From: gilles@harfang.homelinux.org
> To: user@commons.apache.org
> Subject: Re: [math]
>
> Hi.
>
> >
> > Thanks Giles! I was looking in the wrong place. Any suggestions on examples for these classes (a math function example would be very nice)? I've found this link (very helpful) but I don't know what to code in the gradient method. In ParametricUnivariateFunction.value I just returned my function output with the params as arguments (plus x). For gradient, I'm in a pitch.
>
> And I'm lacking context (sorry, I deleted your previous email from my
> inbox)...
>
> Anyways, the "gradient(double x, double ... parameters)" method should
> return the partial derivatives with respect to the _parameters_. So, for
> example:
> ---
> public class ParamFuncExample implements ParametricUnivariateFunction {
> public double value(double x, double ... p) {
> return p[0] * x + p[1];
> }
>
> public double[] gradient(double x, double ... p) {
> return new double[] { x, 1 };
> }
> }
> ---
>
>
> HTH,
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>