0

I would like to calculate the arc length of an already-interpolated piecewise cubic spline, where each segment is defined by a normal cubic polynomial ax^3 + bx^2 + cx + d. I am not sure, however, what the best route to take is.

My first idea is to use numerical integration and the following arc length formula to calculate the arc length for each segment and then sum them up: https://tutorial.math.lamar.edu/classes/calcii/arclength.aspx

I am not sure if this is the best approach, as I have minimal experience in numeric integration. If this is the approach to take, which numeric integration method should I use? If not, how can I accomplish this?

Thanks a lot

Lutz Lehmann
  • 25,219
  • 2
  • 22
  • 51
Gary Allen
  • 1,218
  • 1
  • 13
  • 28
  • Did you think of your base variant as something like (pseudo-matlab) `dp = polyder([a,b,c,d]); ds = @(x) (1+polyval(dp,x).^2).^0.5; s=quad(ds,0,1);` – Lutz Lehmann Jan 18 '21 at 12:57
  • I'm not quite sure what you're asking, sorry. I'm not too familiar with matlab. I am programming the above in C @LutzLehmann – Gary Allen Jan 18 '21 at 13:45
  • `polyder` transforms the coefficient sequence into the one of the derivative, `polyval` evaluates the given polynomial at the given point via Horner scheme, @ defines a function from the expression "on-the-fly", `quad` implements an adaptive quadrature method, I'm not sure if full Romberg integration or adaptive (composite) Simpson rule. In principle, you could implement the parts all as `C` procedures (or find implementations to copy from, these are all rather standard tasks) and compose them in this way. – Lutz Lehmann Jan 18 '21 at 14:04
  • 1
    Ref [How to calculate a spline's length from its control points and knots vector](https://math.stackexchange.com/q/2154029/83175) – chux - Reinstate Monica Jan 18 '21 at 15:12

1 Answers1

1

There is a closed-form expression in terms of the Elliptic integrals, but the exact computation is better done by Mathematica, and next you will need the elliptic functions handy.

The numerical method by polyline approximation (as in the link) is a little too elementary. For such a smooth function, Simpson's rule will be fine. https://en.wikipedia.org/wiki/Simpson%27s_rule