Extrapolation and senstitvities



Trying to follow the calculations in the linearExtrapolator class:
Especially this line :

result[i] = -result[i] * (xValue - lastXValue) / eps;

which calculates the parametersensitivities of an xvalue on the extrpolated right part. this line of code applies for nodes except the last one.

The second term on the right I interprete as the derivative of the extrapolation function with respect to node i. Is that correct? Why is parametersensitivity to (lastXValue - eps) and not lastXvalue used (result)? Hopefully some quick answers otherwise maybe a reference to read more of this.


Let \{x_i,y_i\} (i=0,1,2,\dots) to be the data points and denote the last data point by \{ x_{last},y_{last} \}. Because the right extrapolation is completed by
\displaystyle Y(x) = \frac{y_{last} - Y(x_{last}-\epsilon)}{\epsilon} \cdot \left( x - x_{last} \right) + y_{last} \,,
the node sensitivities are calculated by
\displaystyle \frac{\partial Y(x)}{\partial y_i} = -\frac{\partial Y(x_{last}-\epsilon)}{\partial y_i} \frac{x -x_{last}}{\epsilon} \,,
except the last node. In LinearCurveExtrapolator, this is implemented in L132, and \frac{\partial Y(x_{last}-\epsilon)}{\partial y_i} is stored in rightSens. For the last node we have
\displaystyle \frac{\partial Y(x)}{\partial y_{last}} = \left(1 - \frac{\partial Y(x_{last}-\epsilon)}{\partial y_{last}} \right) \frac{x-x_{last} }{\epsilon} + 1 \,,
as in L134.

I hope this will help.


Brilliant. Thanks a lot!