Gradient and evaluation

Hi all!
I have two questions related to the usage of functions.

The first topic is the way to evaluate the gradient. The script:

import openturns as ot
x = [72.e9, 3e2, 2.5, 1.5e-7]
g = ot.SymbolicFunction(["E", "F", "L", "I"],  ["F*L^3/(3*E*I)"])
jacobian = g.gradient(x)

evaluates the Jacobian matrix by evaluating the gradient method.
There is no way, however, to get the gradient function which would evaluate the gradient. In other words, the script:

jacobian_function = g.getGradient()
jacobian = jacobian_function(x)

does not work, because the ‘Gradient’ object is not callable.
Finally, the following script works:

jacobian_function = g.getGradient()
jacobian = jacobian_function.gradient(x)

but it seems quite surprising. The gradient method should return the gradient. Since jacobian_function is the Jacobian, we may expect that the gradient method should return the Hessian matrix. It would seem that the gradient method of the Gradient class should be removed and that its implementation should be called when the (x) operator is evaluated.

The second topic is the way to create a finite difference gradient with the script:

myGradient = ot.NonCenteredFiniteDifferenceGradient(incrementGrad, g.getEvaluation())
g.setGradient(myGradient)

I understand that a EvaluationImplementation is required to evaluate a finite difference formula. But we may also expect that a more general Function would fit:

myGradient = ot.NonCenteredFiniteDifferenceGradient(incrementGrad, g)
g.setGradient(myGradient)

but that is not true. Why is that? Can’t the NonCenteredFiniteDifferenceGradient call the getEvaluation() method when required?

Regards,

Michaël