--- [EMAIL PROTECTED] wrote:
> On Tue, 30 Mar 2004 21:29:42 -0700, Phil Steitz wrote:
>
> > 0. To help debug the SplineInterpolater (PR #28019 et al), I need to
> > expose the coefficients in o.a.c.m.analysis.Polynomial as a
> read-only
> > property (returning an array copy). Any objections to adding this?
>
>
> > 1. Add protected static double evaluate(double[] coefficients,
> double
> > argument) implementing Horner to get the function value; and change
> > value(double) to just call this.
>
> +1
>
> >
> > 2. Add protected static double[] differentiate(double[] coefficients)
> > to
> > return the coefficients of the derivative of the polynomial with
> > coefficients equal to the actual parameter. Then change
> > firstDerivative(x) to just return
> > evaluate(differentiate(coefficients), x). Similar for
> > secondDerivative.
> > I could adapt Horner for the derivatives, but that seems messy to me
> > and
> > the slight memory cost to create the temp arrays seems worth it.
>
> +1 on the differntiate method.
>
> Are the firstDerivate and secondDerivative methods needed anymore with
> the addition of your derivative method below? I would favor removing
> the prior two methods if possible.
+1 to Brent's suggestion. These methods seem very redundant now, and I never
really liked naming these explicitly, as they seem to beg for derivatives of
all orders to then be named explicitly as well.
> > 3. I would also like to add
> > public PolynomialFunction derivative() {
> > return new PolynomialFunction(differentiate(coefficients));
> > }
>
> Have we considered a design for the general derivative case (i.e. for
> UnivariateRealFunction objects)? I was thinking about a
> Differentiable interface that either extends from URF or is a base
> interface. It would have a single derivative method with a URF return
> value.
>
> Specialized URF types, like PolynomialFunction, could implement and
> general derivative method and could provide their own specialized
> derivative methods. Much like java.util.List with iterator and
> listIterator.
>
> With this approach, the derivative impl for PolynomialFunction could
> be:
>
> public PolynomialFunction polynomialDerivative() {
> return new PolynomialFunction(differentiate(coefficients));
> }
>
> public UnivariateRealFunction derivative() {
> return polynomialDerivative();
> }
>
> Counter thoughts?
>
> Brent Worden
> http://www.brent.worden.org/
That seems pretty reasonable. Should we at least briefly explore what
multivariable differentiation would look like and see if that makes it clearer
what it should look like with a single variable?
For instance, a UnivariateRealFunction can be considered a special case of a
ScalarRealFunction (I thought about writing MultivariateRealFunction there, but
semantically it seems wrong to call Univariate... a special case of
Multivariate...). For a RealFunction of n variables, the quintessential
derivatives are the first partial derivatives with respect to each of the n
variables, from which the gradient and other del-operator-based vector
functions spring. For second derivatives we quickly generate the matrix of all
mixed partial derivatives.
Where is this leading? I guess one direction might be an interface containing
a differentiate() method that calculates a first derivative, which in n
dimensions would require the user to specify which of the n variables to
differentiate with respect to, but in one dimension would not, for obvious
reasons. So I guess the Brent's suggestion holds, and the generalization to
more dimensions would be
public ScalarRealFunction derivative(Variable x) {
// implementation of first derivative with respect to x
}
I don't care to tackle vector functions of any number of variables at the
moment. <g>
Al
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]