"Christoph Höger" <[email protected]> a écrit :
>Dear all,
Hi Christoph,
>
>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?
I am not sure I understood your use case properly. I'll look at it further in
the next few days.
A first very quick answer is that the interface as it is defined does not seem
to correspond to your needs.
In the current interface, the meaning of the two "value" method is the same. So
the various elements in
The point array should be the same. In your case, I think you already use the
array to represent derivatives
of the first element, so I think you expanded the content of what should be a
single DerivativeStructure instance as a double array.
Are you sure you should not use a univariate function ? The DerivativeStructure
argument you would get
would contain all the partial derivatives already.
Once again, I'm not sure I understood your example properly as I did not find
the time to think about it for now.
Best regards,
Luc
--
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]