1%feature("docstring") OT::LinearTaylor
2"First order polynomial response surface by Taylor expansion.
3
4Available constructors:
5    LinearTaylor(*center, function*)
6
7Parameters
8----------
9center : sequence of float
10    Point :math:`\vect{x}_0` where the Taylor expansion of the function
11    :math:`h` is performed.
12function : :class:`~openturns.Function`
13    Function :math:`h` to be approximated.
14
15Notes
16-----
17The approximation of the model response :math:`\vect{y} = h(\vect{x})` around a
18specific set :math:`\vect{x}_0 = (x_{0,1},\dots,x_{0,n_{X}})` of input
19parameters may be of interest. One may then substitute :math:`h` for its Taylor
20expansion at point :math:`\vect{x}_0`. Hence :math:`h` is replaced with a first
21or second-order polynomial :math:`\widehat{h}` whose evaluation is inexpensive,
22allowing the analyst to apply the uncertainty anaysis methods.
23
24We consider here the first order Taylor expansion around :math:`\ux=\vect{x}_0`.
25
26.. math::
27
28    \vect{y} \, \approx \, \widehat{h}(\vect{x}) \,
29      = \, h(\vect{x}_0) \, +
30        \, \sum_{i=1}^{n_{X}} \; \frac{\partial h}{\partial x_i}(\vect{x}_0).\left(x_i - x_{0,i} \right)
31
32Introducing a vector notation, the previous equation rewrites:
33
34.. math::
35
36    \vect{y} \, \approx \, \vect{y}_0 \, + \, \vect{\vect{L}} \: \left(\vect{x}-\vect{x}_0\right)
37
38where:
39
40- :math:`\vect{y_0} = (y_{0,1} , \dots, y_{0,n_Y})^{\textsf{T}} = h(\vect{x}_0)`
41  is the vector model response evaluated at :math:`\vect{x}_0`;
42- :math:`\vect{x}` is the current set of input parameters;
43- :math:`\vect{\vect{L}} = \left( \frac{\partial y_{0,j}}{\partial x_i} \,,\, i=1,\ldots, n_X \,,\, j=1,\ldots, n_Y \right)`
44  is the transposed Jacobian matrix evaluated at :math:`\vect{x}_0`.
45
46See also
47--------
48QuadraticTaylor, LinearLeastSquares, QuadraticLeastSquares
49
50Examples
51--------
52>>> import openturns as ot
53>>> formulas = ['x1 * sin(x2)', 'cos(x1 + x2)', '(x2 + 1) * exp(x1 - 2 * x2)']
54>>> myFunc = ot.SymbolicFunction(['x1', 'x2'], formulas)
55>>> myTaylor = ot.LinearTaylor([1, 2], myFunc)
56>>> myTaylor.run()
57>>> responseSurface = myTaylor.getMetaModel()
58>>> print(responseSurface([1.2,1.9]))
59[1.13277,-1.0041,0.204127]"
60
61// ---------------------------------------------------------------------
62
63%feature("docstring") OT::LinearTaylor::getCenter
64"Get the center.
65
66Returns
67-------
68center : :class:`~openturns.Point`
69    Point :math:`\vect{x}_0` where the Taylor expansion of the function is
70    performed."
71
72// ---------------------------------------------------------------------
73
74%feature("docstring") OT::LinearTaylor::getConstant
75"Get the constant vector of the approximation.
76
77Returns
78-------
79constantVector : :class:`~openturns.Point`
80    Constant vector of the approximation, equal to :math:`h(x_0)`."
81
82// ---------------------------------------------------------------------
83
84%feature("docstring") OT::LinearTaylor::getLinear
85"Get the gradient of the function at :math:`\vect{x}_0`.
86
87Returns
88-------
89gradient : :class:`~openturns.Matrix`
90    Gradient of the function :math:`h` at the point :math:`\vect{x}_0` (the
91    transposition of the jacobian matrix)."
92
93// ---------------------------------------------------------------------
94
95%feature("docstring") OT::LinearTaylor::getInputFunction
96"Get the function.
97
98Returns
99-------
100function : :class:`~openturns.Function`
101    Function :math:`h` to be approximated."
102
103// ---------------------------------------------------------------------
104
105%feature("docstring") OT::LinearTaylor::getMetaModel
106"Get an approximation of the function.
107
108Returns
109-------
110approximation : :class:`~openturns.Function`
111    An approximation of the function :math:`h` by a Linear Taylor expansion at
112    the point :math:`\vect{x}_0`."
113
114// ---------------------------------------------------------------------
115
116%feature("docstring") OT::LinearTaylor::run
117"Perform the Linear Taylor expansion around :math:`\vect{x}_0`."
118