Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

What is the length of a sine wave from $0$ to $2\pi$? Physically I would plot $$y=\sin(x),\quad 0\le x\le {2\pi}$$ and measure line length.

I think part of the answer is to integrate this: $$ \int_0^{2\pi} \sqrt{ 1 + (\sin(x))^2} \ \rm{dx} $$

Any ideas?

share|improve this question
    
Does the dx math-e-magically escape the sqrt? –  philcolbourn Jun 13 '11 at 12:04
    
Thanks everyone. –  philcolbourn Jun 17 '11 at 12:07
1  
Can someone answer with a simple number? I need this to know how much paint to buy to paint my corrugated sheet roof. –  SF. Aug 23 '13 at 19:46
    
FWIW, I've created a JS demo showing numerical integration of this function, with the purpose of evenly spacing points along the curve (as opposed to along the X axis). jsfiddle.net/fp7aknoc –  Alnitak Oct 7 at 7:22

4 Answers 4

up vote 13 down vote accepted

I'm nowhere near a computer with elliptic integrals handy, so I'll give the explicit evaluation of

$$\int_0^{2 \pi} \sqrt{1+\cos^2 x}\,\mathrm dx$$

Note that an entire sine wave can be cut up into four congruent arcs; we can thus consider instead the integral

$$4\int_0^{\pi/2} \sqrt{1+\cos^2 x}\,\mathrm dx$$

(alternatively, one can split the integral into four "chunks" and find that those four chunks can be made identical; I'll leave that manipulation to somebody else.)

Now, after some Pythagorean manipulation:

$$4\int_0^{\pi/2} \sqrt{1+\cos^2 x}\,\mathrm dx=4\int_0^{\pi/2} \sqrt{2-\sin^2 x}\,\mathrm dx$$

and then a bit of algebraic massage:

$$4\sqrt{2}\int_0^{\pi/2} \sqrt{1-\frac12\sin^2 x}\,\mathrm dx$$

we then recognize the complete elliptic integral of the second kind $E(m)$

$$E(m):=\int_0^{\pi/2}\sqrt{1-m\sin^2u}\mathrm du$$

(where $m$ is a parameter):

$$4\sqrt{2}E\left(\frac12\right)$$

As Robert notes in a comment, different computing environments have different argument conventions for elliptic integrals; Maple for instance uses the modulus $k$ (thus, $E(k)$) instead of the parameter $m$ as input (as used by Mathematica and MATLAB), but these conventions are easy to translate to and from: $m=k^2$. So, using the modulus, the answer is then $4\sqrt{2}E\left(\frac1{\sqrt 2}\right)$.


Now to address the noted equivalence for negative parameter and a parameter in the interval $(0,1)$ by Henry, there is what's called the "imaginary modulus transformations"; the DLMF link gives the transformation for the incomplete case, but I'll explicitly do the complete case here for reference since it's not too gnarly to do (all you have to remember are the symmetries of the trigonometric functions):

Letting $E(-1)=\int_0^{\pi/2}\sqrt{1+\sin^2 u}\,\mathrm du$, we then go this way:

$$\int_0^{\pi/2}\sqrt{1+\sin^2 u}\,\mathrm du=\int_{-\pi/2}^0\sqrt{1+\sin^2 u}\,\mathrm du$$

$$=\int_0^{\pi/2}\sqrt{1+\sin^2\left(u-\frac{\pi}{2}\right)}\,\mathrm du=\int_0^{\pi/2} \sqrt{1+\cos^2 u}\,\mathrm du$$

from which I've shown what you're supposed to do earlier.


Computationally, the complete elliptic integral of the second kind isn't too difficult to evaluate, thanks to the arithmetic-geometric mean. Usually, this method is used for computing the complete elliptic integral of the first kind, but the iteration is easily hijacked to compute the integral of the second kind as well.

Here's some C(-ish) code for computing $E(m)$:

#include <math.h>

double ellipec(double m)
{
    double f, pi2, s, v, w;

    if (m == 1.0)
        return 1.0;

    pi2 = 2.0 * atan(1.0);

    v = 0.5 * (1.0 + sqrt(1 - m));
    w = 0.25 * m / v;
    s = v * v;
    f = 1.0;

    do {
        v = 0.5 * (v + sqrt((v - w) * (v + w)));
        w = 0.25 * w * w / v;
        f *= 2.0;
        s -= f * w * w;
    } while (abs(v) + abs(w) != abs(v))

    return pi2 * s / v;
}

(make sure either your compiler does not (aggressively) optimize out the while (abs(v)+abs(w) != abs(v)) potion, or you'll have to use a termination criterion of the form abs(w) < tinynumber.)


Finally,

"I am also puzzled: a circle's circumference is $2\pi r$ and yet an ellipse's is an infinite series - why?"

My belief is that we are actually very lucky that the arclength function for a circle is remarkably simple compared to most other curves, the symmetry of the circle (and thus also the symmetry properties of the trigonometric functions that can parametrize it) being one factor. The reduction in symmetry in going from a circle to an ellipse means that you will have to compensate for those "perturbations", and that's where the series comes in...

share|improve this answer
    
This is not yet my official return; I decided to answer this question in the short time I have access to a computer today. –  J. M. Jul 5 '11 at 7:36
1  
Well J. M. your contributions to the site a very much appreciated so even if it is only to answer a question every now and then when you have some free time and computer access, it is really a great thing. Good luck with whatever you're doing =) –  Adrián Barquero Jul 5 '11 at 7:45
    
Thanks. I am out of my depth here and I don't really understand what E(x) is. It is interesting that a seemingly simple question can have a complex and I gather a difficult answer to calculate. I am also puzzled: a circle's circumference is 2.pi.r and yet an ellipse's is an infinite series - why? –  philcolbourn Jul 7 '11 at 12:01
    
@phil: On the contrary, the complete elliptic integral is in fact not very hard to evaluate numerically. Let me update this answer a bit... –  J. M. Jul 14 '11 at 9:02

The arc length of the graph of a function $f$ between $x=a$ and $x=b$ is given by $ \int_{a}^{b} \sqrt { 1 + [f'(x)]^2 }\, dx$. So, if you're considering $f(x)=\sin(x)$ then the correct integral is $\int_{0}^{2\pi} \sqrt { 1 + [\cos(x)]^2 }\, dx$. Unfortunately, this integral cannot be expressed in elementary terms. This is quite common for arc-length integrals. However, the definite integral might be expressible in elementary terms; Wolfram Alpha says it cannot.

share|improve this answer
3  
That's interesting, as the two definite integrals are clearly the same over this interval. Following up my comment to Chandru's answer, Wolfram Alpha's gives you $4 \sqrt{2} E(\tfrac{1}{2}) \approx 7.6404$, which is the circumference of an ellipse. –  Henry Jun 13 '11 at 12:03

It is given by $$I = \int_{0}^{2 \pi} \sqrt{ 1 + (\cos{x})^{2}} \ \rm{dx}$$ and I think this is an elliptic integral of the second kind. (That's what Wolfram says.)

share|improve this answer
2  
Wolfram Alpha gives it as $4E(-1) \approx 7.6404$ where $E(m)$ is the complete elliptic integral of the second kind, though clearly not the circumference of an ellipse with eccentricity $-1$. –  Henry Jun 13 '11 at 11:42
    
@Henry: Thanks. My simple 8-straight line approximation yielded 7.58... –  philcolbourn Jun 13 '11 at 12:11
    
The first word of this answer isn't quite right, because the value of the integral in the question is correct. –  Jonas Meyer Jun 13 '11 at 18:47
    
@Jonas: for the arc length it has to derivative of $\sin{x}$ that is $\cos{x}$, so I have added $\cos{x}$ –  user9413 Jun 13 '11 at 18:50
    
Maple, which uses a different convention for the elliptic integrals, gives the answer as $4 \sqrt{2} {\rm EllipticE}(\sqrt{2}/2)$. The circumference of an ellipse with semi-major axis $a$ and eccentricity $e$ would be, in this notation, $4 a {\rm EllipticE}(e)$. –  Robert Israel Jun 13 '11 at 19:28

Responding to Henry, June 6, 2011, this equivalence emerges from a simple experiment given by Hugo Steinhaus in 'Mathematical Snapshots'. Take a roll of something (I use paper towelling) and saw through it obliquely, thus producing elliptic sections. Unroll it and you have a sine curve. (Tom Apostol and Mamikon Mnatsakanian suggest you rest a paint roller at an angle in the paint tray. Then paint!)

Paul Stephenson May 8 '13 at 21.00

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.