commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <Luc.Maison...@free.fr>
Subject Re: [math] API proposal for differentiation
Date Tue, 24 Jul 2012 08:35:12 GMT
Le 23/07/2012 17:03, Anxionnat Julien a écrit :
> Hi Luc,
> Hi all,
> 
>> [...]
>> Last week, at work, someone asked me again about differentiation and I
>> directed him to this issue and also to the Nabla project. He told me he
>> was interested in having some support in [math] for this (I'm not sure
>> he reads this list, but if he does, I hope he will join the
>> discussion).
> 
> To precise your introduction, I'm working at the french space agency (Cnes) on satellite
guidance and attitude.
> 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 suggest we deprecate this interface and add a new one defining
>> method:
>>
>>  RallNumber value(RallNumber x)
>>
>> This interface could extend UnivariateFunction in which case when we
>> want to compute only the value we use the same object, or it could also
>> define a getPrimitive method the would return a separate primitive
>> object (this is how it is done in Nabla, with the interface
>> UnivariateDerivative
>> (<http://commons.apache.org/sandbox/nabla/apidocs/org/apache/commons/na
>> bla/core/UnivariateDerivative.html>),
>> or it can even be completely separate from UnivariateFunction.
>>
>> Multivariate differentiable functions or vector valued functions would
>> be done exactly the same way: replacing the parameter or return value
>> types from double arrays to RallNumber arrays. This would be much more
>> consistent than what we currently have (we have methods called
>> partialDerivatives, gradients, jacobians and even several methods
>> called
>> derivative which do not have the same signatures).
> 
> 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)

> 
> 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.

> 
> 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>)

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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


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


Mime
View raw message