kbarbary / Dierckx.jl

Julia package for 1-d and 2-d splines
Other
157 stars 30 forks source link

allow integration of a function of a spline #47

Open BeastyBlacksmith opened 6 years ago

BeastyBlacksmith commented 6 years ago

Would it be hard to allow for integration of a function of the spline?

For example

integrate( spl, a, b, (val) -> val^2 )

And then one integrates the square of the spline values.

BeastyBlacksmith commented 6 years ago

another question to the same topic: integrate and derivative are not intended to be used with ParametricSplines do they?

kbarbary commented 6 years ago

The underlying Fortran library doesn't allow for integrating an arbitrary function like integrate(spl, a, b, (x) -> x^2). But you could apply this function before creating the spline, like spl = Spline1D(x, y^2) rather than spl = Spline1D(x, y).

I think integrate and derivative on a ParametricSpline are the integral and derivative in each dimension, with respect to the curve parameter. So a curve through N dimensional space will have an integral that is a length N vector. Is that right @bshall?