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]
Date Thu, 05 Jul 2012 17:21:46 GMT
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


Mime
View raw message