# commons-user mailing list archives

##### Site index · List index
Message view
Top
From Christoph Höger <christoph.hoe...@tu-berlin.de>
Subject Re: [math] Total derivative of a MultivariateVectorFunction
Date Wed, 22 May 2013 14:12:21 GMT
```For the records: Please exchange MultivariateVectorFunction with
MultivariateDifferentiableFunction in my mail below.

Am 22.05.2013 13:52, schrieb Christoph Höger:
> Dear all,
>
> I am currently working with the DerivativeStructure-based AD framework
> integrated into math 3.2.
>
> Calculating the n-th order partial derivatives works fine, but I am
> facing some trouble calculating the n-th order total derivative of a
> MultivariateVectorFunction.
>
> My Idea was to have a class Derivative (implementing
> MultivariateVectorFunction) that delegates to its base
> MultivariateVectorFunction and returns the first order total derivative
> of that function. Chaining many such classes should create the n-th
> order total derivative (direct creation would be an optimization).
>
> The class looks like this:
>
> public final class Derivative implements
> MultivariateDifferentiableFunction {
>
>     private final MultivariateDifferentiableFunction base;
>
>     @Override
>     public double value(double[] point) {
>         final int dim = 1 + point.length / 2;
>
>         final DerivativeStructure[] dpoint = new DerivativeStructure[dim];
>         for (int i = 0; i < dim; i++)
>             dpoint[i] = new DerivativeStructure(dim, 1, i, point[i]);
>
>         final double[] dvalue = base.value(dpoint).getAllDerivatives();
>
>         double ret = dvalue[0]; // 𝛿base/𝛿t
>
>         for (int i = 1; i < dvalue.length; i++)
>             ret = dvalue[i] * point[i + dim]; // 𝛿base/𝛿point[i] *
>                                               // dpoint[i]/dt
>
>         return ret;
>     }
>
>     @Override
>     public DerivativeStructure value(DerivativeStructure[] point)
>             throws MathIllegalArgumentException {
>        //??
>         return null;
>     }
>
> }
>
> As you can see, the Derivative takes _more_ parameters than the base
> function. Those additional parameters are the total derivatives of the
> original parameters. The first parameter is the independent variable.
>
> This function is highly regular, and I can probably just calculate the
> partial derivatives directly:
>
> The partial derivative of a parameter from 1 to (dim-1) is the second
> order partial derivative of that parameter in base. The partial
> derivative of a parameter from dim upwards is the corresponding partial
> derivative of base.
>
>
> My problem is: What shall I do with the DerivativeStructure[] point I am
> handed from the outside? How to get them into the equation?
>
>

--
Christoph Höger

Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin

Tel.: +49 (30) 314-24890
E-Mail: christoph.hoeger@tu-berlin.de

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

```
Mime
View raw message