1%feature("docstring") OT::CenteredFiniteDifferenceHessian
2"Second order centered finite-difference scheme.
3
4Available constructors:
5    CenteredFiniteDifferenceHessian(*epsilon, evalImpl*)
6
7    CenteredFiniteDifferenceHessian(*step, evalImpl*)
8
9Parameters
10----------
11evalImpl : :class:`~openturns.EvaluationImplementation`
12    Implementation of the evaluation of a function.
13epsilon : float, sequence of float
14    Finite difference steps for each dimension.
15step : :class:`~openturns.FiniteDifferenceStep`
16    Defines how finite difference steps values are computed.
17
18Notes
19-----
20*CenteredFiniteDifferenceHessian* provides a second order centered finite-
21difference scheme:
22
23.. math::
24
25  \frac{\partial^2 f_k}{\partial x_i \partial x_j} \approx
26                                     \frac{
27                                        f_k(x + \epsilon_i + \epsilon_j) -
28                                        f_k(x + \epsilon_i - \epsilon_j) +
29                                        f_k(x - \epsilon_i - \epsilon_j) -
30                                        f_k(x - \epsilon_i + \epsilon_j)}
31                                     {4 \epsilon_i \epsilon_j}
32
33Examples
34--------
35>>> import openturns as ot
36>>> formulas = ['x1 * sin(x2)', 'cos(x1 + x2)', '(x2 + 1) * exp(x1 - 2 * x2)']
37>>> myFunc = ot.SymbolicFunction(['x1', 'x2'], formulas)
38>>> epsilon = [0.01]*2
39>>> myHessian = ot.CenteredFiniteDifferenceHessian(epsilon, myFunc.getEvaluation())
40>>> inPoint = [1.0]*2
41>>> print(myHessian.hessian(inPoint))
42sheet #0
43[[  0         0.540293 ]
44 [  0.540293 -0.841443 ]]
45sheet #1
46[[  0.416133  0.416133 ]
47 [  0.416133  0.416133 ]]
48sheet #2
49[[  0.735783 -1.10368  ]
50 [ -1.10368   1.47152  ]]"
51