> > [...] > > I have to deal with functions like that: > > > > public double[] value (double t) { ... } > > > > (The best interface for my subjects would be: public Vector3D value > (double t) { ... }, but it's not the point now.) > > > > > >> > >> [...] > >> > > > > I'm sorry, I don't understand how it's gonna be for my function : > > value(double t): double[] > > It would simply be > RallNumber[] value(RallNumber)
Ok. (I had understood that a RallNumber for vectors was necessary. So I had coded a RallNumber class with double[] value and double[] firstDerivative.) > > > > > I just tried to code the interfaces (UnivariateVectorDifferentiable, > UnivariateVectorDerivative, DifferentialPair, > UnivariateVectorDifferentiator) and the TwoPointsScheme differentiator. > > We already have all of this in Nabla (up to 8 points scheme and also > algorithmic forward mode directly from bytecode analysis, for simple > functions that do not call other functions or store intermediate values > in fields), so don't worry about this. > I didn't see the interfaces for vector functions, so I coded them in local (just to help me to understand): - UnivariateVectorDifferentiable: double[] f(double t) - UnivariateVectorDerivative: UnivariateVectorDifferentiable getPrimitive() RallNumber[] f(RallNumber t) - UnivariateVectorDifferentiator: UnivariateVectorDerivative differentiate(UnivariateVectorDifferentiable d) and a TwoPointsScheme differentiator for vector functions. Now, everything it's ok for me. I've just one question : - Should we have a specific abstract class for finite differences differentiator for vector functions (called FiniteDifferencesVectorDifferentiator) ? - OR prefer to implement the UnivariateVectorDifferentiator in the FiniteDifferencesDifferentiator ? and have to code the differentiate method for vectors for the two to eight points schemes (which interest us) ? > > > > If I get your purpose, DifferentialPair has to contain: > > - "zero-order": x, f(x) > > - first order: f(x), f'(x) > > - second order: f'(x), f''(x) > > - etc. > > No. > If we want to go already to more than 1st order, then we need to use an > extension of Rall numbers. See for example the paper "Doubly Recursive > Multivariate Automatic Differentiation" by Dan Kalman in 2002 > (<http://www1.math.american.edu/People/kalman/pdffiles/mmgautodiff.pdf> > ) > I'll check this, thanks. Julien > We could do this already from the beginning, i.e. our RallNumber class > would be built with the order and the number of free variables. > However, > it would be user responsibility to ensure consistency between free > variables x and y in a function like f(x, y). User should make sure > that > if x is associated with index 0 in one variable, the y is associated > with a different index, and in both cases the derivation orders are > equal. > > > > => What happens for the zero order (x is a double, not an array of > double) ? > > Then x is just one variable. > > Luc > > > > > > > Regards, > > Julien > > > >