arclength, a Python code which estimates the arclength of curves of the form (x,f(x)) or (x(t),y(t)).

We suppose a curve has been drawn, and the length of a segment of that curve is to be estimated. Several cases arise:

  1. (x,y(x)): the curve is an explicit function of a scalar variable x. The arclength is to be measured from (x1,y(x1)) to (x2,y(x2)). X is taken to be the parameter. The user supplies a function that evaluates dy/dx.
  2. (x(t),y(t)): The curve is parameterized by t. The arclength is to be measured from (x(t1),y(t1)) to (x(t2),y(t2)), and the user supplies functions that evaluate dx/dt and dy/dt. Functions described by polar coordinates are an example.

The user supplies the limits of the parameter, the function that evaluates the necessary derivatives, and a number n that indicates how the parameter interval x1 ≤ x ≤ x2 or t1 ≤ t ≤ t2 is to be subdivided.


The computer code and data files described and made available on this web page are distributed under the MIT license


arclength is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

Source Code:

Last revised on 17 April 2023.