# Differences

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision | |||

documentation:language_reference:objects:interpolatingfunction:start [2018/09/26 12:12] Martin Brass |
documentation:language_reference:objects:interpolatingfunction:start [2019/09/09 10:49] (current) Martin Brass Arithmetics added |
||
---|---|---|---|

Line 3: | Line 3: | ||

### | ### | ||

- | 1D interpolation is currently implemented using cubic splines. Further methods will follow. An interpolating function can be evaluated at a given point or on a set of points, which gives a speed boost, if these points are in ascending order. Higher order derivatives of the interpolating function can also be evaluated. | + | 1D interpolation is currently implemented using cubic splines. Further methods will follow. An interpolating function can be evaluated at a given point or on a set of points, which gives a speed boost, if these points are in ascending order. Higher order derivatives of the interpolating function can also be evaluated. Multiple arithmetic operations on interpolating functions are implemented. Addition and subtraction of splines of a given order leads to a new spline of the same order. For multiplication, division and concatenation this is in general not the case. However, we chose to return an interpolating function of the same type and order such that the function values at the knots are correct. |

### | ### | ||

Line 23: | Line 23: | ||

f({1.2,2.5,2.7,2.9}) -- evaluates f successively at the given values | f({1.2,2.5,2.7,2.9}) -- evaluates f successively at the given values | ||

+ | |||

+ | y2 = {2,1,2} | ||

+ | g = InterpolatingFunction.Spline(x,y2) | ||

+ | y3 = {2,4,18} -- this equals y * y2 | ||

+ | |||

+ | -- Arithmetics: | ||

+ | f + g | ||

+ | f - g | ||

+ | |||

+ | FtimesG = InterpolatingFunction.Spline(x,y2) | ||

+ | print(FtimesG == f * g) -- these functions are equal | ||

+ | |||

+ | f^3 == f*f*f | ||

+ | |||

+ | f..g -- concatenation; let X be a subset of the interval on which g is defined, when evaluating f..g on X make sure that f is defined on the image g(X), otherwise you'll get an error | ||

+ | |||

+ | InterpolatingFunction.Integrate(f) -- integrates f over its full domain | ||

+ | a = 1.5 | ||

+ | b = 2.5 | ||

+ | InterpolatingFunction.Integrate(f,a,b) -- integrates f from a to b | ||

+ | |||

</code> | </code> | ||

- | ==== Result ==== | ||

- | <file Quanty_Output> | ||

- | Try it yourself ;) | ||

- | </file> | ||

===== Table of contents ===== | ===== Table of contents ===== | ||

{{indexmenu>.#1|msort}} | {{indexmenu>.#1|msort}} | ||