gizmobench

Curve Arc Length Calculator

Type a curve and an interval and the length appears with its own error estimate underneath, which is the part most arc length calculators leave out: the integral behind arc length has no closed form for most curves, so the honest answer is a number plus how far it might be off. The derivative is taken symbolically, exactly, rather than by a difference quotient, so the only approximation on the page is the integration itself, and that is adaptive Simpson: each interval is measured once whole and once in halves, and the difference between those two measurements is the error estimate. Agreement between the two is not on its own enough to finish the interval, because a speed that repeats on the sampling grid gives the same reading however often the interval is halved, so the interval is measured a third time with its split a third of the way along and has to agree there too. Switch to the parametric mode for x(t) and y(t), and note that bounds may be written as expressions of pi, so 0 to pi/2 is an interval. Every answer is then checked against the line through 513 points on the curve, which an arc can never be shorter than, so a sampling that stepped over part of the curve is caught rather than printed, and against the same line through 2,049 points, which catches the opposite mistake of counting a stretch of the curve twice. Where the curve has a vertical tangent or a pole inside the interval, as 1/x does across zero, the page names the point and refuses rather than printing a figure that looks like an answer.

Arc length1.478943y = x^2 on 0 to 1 · Adaptive Simpson · estimated error < 1e-9
Curve
x from
Length
1.478943
Interval
0 to 1
Est. error
< 1e-9
Method
Adaptive Simpson

Adaptive Simpson on a speed of sqrt(1+(2*x)^2), accepted in 32 segments after 240 evaluations, under a tolerance of 1e-8.

dy/dx = 2*x

The line through 513 points on the curve is 1.478943 long, and an arc is never shorter than that.

  • y = x on 0 to 1a straight line
    1.414214, which is √2
  • y = x² on 0 to 1curved
    1.478943
  • x = cos t, y = sin t on 0 to π/2parametric
    1.570796, which is π/2

Accuracy. The length is a numerical approximation and never an exact one, so the page prints its own error estimate beside it and you can see how many digits to trust. Integration is adaptive Simpson on the speed of the curve, under the tolerance and evaluation cap you set. An interval containing a singularity, such as 1/x across zero, fails by name instead of returning a number that looks like an answer.

What you can type

Numbers, the variable of the mode, the constants pi and e, the signs + - * / ^ and brackets, and these functions: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, sqrt, abs, log. ln is read as log, which is the natural logarithm here, and arcsin, arccos and arctan are read as asin, acos and atan. Multiplication can be left out where it is obvious, so 2x, 3 cos(t) and 2(x + 1) all read the way you would write them on paper, and the stage prints back what that came to. The bounds take the same expressions, so pi/2 and 2pi are intervals. An expression runs to 500 characters, the tolerance from 1e-3 to 1e-8, and the evaluation cap from 300 to 20000.

Common questions

How is the arc length worked out?
For a curve y = f(x) the length is the integral of the speed sqrt(1 + f'(x)^2) between the two bounds; for a parametric curve it is the integral of sqrt(x'(t)^2 + y'(t)^2). This page differentiates your expression symbolically, so the speed carries no step-size error of its own, and then integrates it by adaptive Simpson: each interval is measured as one Simpson panel and as two, and the difference between the two measurements is the error estimate for it. Agreement is not the whole test, because a speed whose period divides the interval lands on the same phase however often the interval is halved, so the interval is measured again with its split a third of the way along, where a halving never reaches, and is finished only when that agrees as well. The estimates of the finished pieces are added up, and the figure beside the length is that sum rounded up to the next power of ten, so it reads as a bound such as < 1e-9, which is what the parabola on 0 to 1 comes back with, rather than a long decimal. It never claims better than 1e-12, which is about where double precision runs out for a sum like this.
Why does it show an error estimate instead of an exact answer?
Because for almost every curve there is no exact answer to show. A straight line and a circle have closed forms, and the page agrees with them: y = x from 0 to 1 comes to 1.414214, which is the square root of 2, and a quarter of the unit circle comes to 1.570796, which is pi/2. A parabola already needs a logarithm to write down, and most curves need nothing that can be written down at all, so the value is computed rather than derived. Printing the estimated error beside it is what tells you how many of the six decimals are real.
Why does 1/x across zero fail instead of giving a number?
Because the speed of that curve is not finite at zero, so no finite length exists through that point and any number printed there would be an artefact of where the samples happened to land. The page evaluates the speed at the bounds and the midpoint first, names the point where it blows up, and stops. The same thing happens at a vertical tangent, for example y = sqrt(1 - x^2) taken all the way to -1 and 1, where the derivative is infinite at both ends. The way round it is to move the bound slightly past the point or to measure each side of it on its own.
How do I know the number is not quietly wrong?
Two ways, and both are on the page. The first is the error estimate, which comes out of the integration itself: an interval counts as finished only when the one panel, the two halves and a third measurement split a third of the way along all agree, which is what stops a speed that repeats on the sampling grid from agreeing with itself about a shape it never sampled. The second is a check that uses no method at all: the length of the straight line through 513 points taken along the curve, printed under the readout. An arc is never shorter than a line drawn through its own points, so that figure is a lower bound the answer has to clear, and a result below it is refused instead of shown. The same line through 2,049 points closes the other direction: once adding points has stopped making it longer it is the length of the curve rather than a bound under it, and an answer above that is refused too, because it has counted part of the curve more than once. It matters more than it sounds: the astroid x = cos(t)^3, y = sin(t)^3 has a speed of zero at each of its four corners, so a single Simpson panel over a full turn sees nothing but zeros, agrees with itself and reports a length of zero. This page starts on sixteen intervals rather than one and gives 6.000000, the closed form, with the inscribed line agreeing underneath.
Can it measure a parametric curve?
Yes. Switch the Curve control to x(t), y(t) and you get two boxes, one for each coordinate, with the interval running over t rather than x. That mode is what handles curves a function of x cannot describe, such as a full circle: x = cos t, y = sin t from 0 to pi/2 is a quarter of the unit circle and comes to 1.570796. Bounds are read as expressions, so pi/2 and 2pi can be typed as they are written.
What do the tolerance and the evaluation cap do?
The tolerance is how close the answer has to be before adaptive Simpson stops subdividing, and it runs from 1e-3 down to 1e-8. Tighter is not always better: it costs more evaluations of the speed, and below 1e-8 a sum of double precision panels cannot honestly hold the claim anyway. The evaluation cap is the budget, up to 20,000, and it is what stops a curve that oscillates faster than the method can follow from freezing the page. A curve that spends the whole budget without meeting the tolerance says so and suggests loosening the tolerance, raising the cap or splitting the interval, instead of printing whatever it had reached. y = sin(32x) over 0 to 2pi is one of those: at the tightest tolerance it spends the whole budget and refuses, and at 1e-3 it comes back as 128.334460 with a bound of < 1e-4.
What can I type into the curve box?
Numbers, the variable of the mode, the constants pi and e, the signs + - * / ^ with brackets, and these functions: sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, sqrt, abs and log. ln is read as log, the natural logarithm, and arcsin, arccos and arctan are read as asin, acos and atan. Multiplication can be left out where it is obvious, so 2x and 3 cos(t) work, and the stage prints back the expression it actually read so an implied multiplication or a missing bracket cannot pass for the question you asked. An expression can be up to 500 characters long.
Does it agree with the textbook examples?
The ones with a closed form, yes, and they are the cases worth checking a numerical method against. A flat line y = 0 from 0 to 3 gives exactly 3. The parabola y = x squared from 0 to 1 gives 1.478943, against the closed form of half the square root of 5 plus a quarter of the inverse hyperbolic sine of 2. The catenary y = cosh(x) from 0 to 1 gives 1.175201, which is sinh(1), the shape of a hanging chain. A circle arc y = sqrt(1 - x^2) over a span of one unit around the origin gives the angle it covers.
Does my curve leave the browser?
No. There is no account, no file to send and no server call: the reading, the derivative and the integration all happen in this tab, and nothing you type is sent anywhere or recorded in analytics. The curve, the interval and the settings are kept in your browser local storage so the page opens where you left it, and the Start over button at the top of the page forgets them.

The length is a numerical approximation and never an exact one, so the page prints its own error estimate beside it and you can see how many digits to trust. Integration is adaptive Simpson on the speed of the curve, under the tolerance and evaluation cap you set. An interval containing a singularity, such as 1/x across zero, fails by name instead of returning a number that looks like an answer.