• Quick note - the problem with Youtube videos not embedding on the forum appears to have been fixed, thanks to ZiprHead. If you do still see problems let me know.

"Length" of a Sine Wave?

garys_2k

Muse
Joined
Jan 9, 2003
Messages
756
A friend who helps design vehicles asked me how to estimate the length of a trip travelled on a sinusoidally "bumpy" road. Hmm, so how long would a sine be?

If you had an x-axis 2*pi long, and impressed on it a sine of unit height (peak at +/- 1), what would the length of the wave be for a bug crawling along it? I can't work out the integral, it gets bogged into forms I can't resolve, but this is one of those problems that seems like it should be easy.

I did a quick numerical analysis and got 2.43*pi, but is there an exact answer?
 
ceptimus said:
I also got 2.4320134 π using numerical methods. I don't know if there is an exact answer. Tricky problem.

Edit to add a google result: http://mathforum.org/library/drmath/view/52038.html

You can use the line integral of the curve. The solution for a sine wave of y=sin(x) is:

Integral[sqrt(cos<sup>2</sup>(x)+1)] between limits of x=0 and x=2*pi

Which gives the answer you derived numerically above. Assuming an amplitude of 1 of course...
 
Pragmatist said:


You can use the line integral of the curve. The solution for a sine wave of y=sin(x) is:

Integral[sqrt(cos<sup>2</sup>(x)+1)] between limits of x=0 and x=2*pi

Which gives the answer you derived numerically above. Assuming an amplitude of 1 of course...
Feel free to integrate it for us. :p (If you haven't tried, it ain't easy)

Walt
 
I couldn't integrate it, so I did this:
Code:
#include <stdio.h>
#include <math.h>
#define PI 3.1415926535897932384626433832795

int main(int argc, char* argv[])
{
	double x, y, ox, oy, length;

	ox = oy = length = 0.0;
	
	for (x = 0.0; x <= PI; x += 1e-8) {
		y = sin(x);
		length += sqrt((x - ox)*(x - ox) + (y - oy)*(y - oy));
		ox = x;
		oy = y;
	}

	printf("%10.7f\n", length * 2.0 / PI);

	return 0;
}
 
Walter Wayne said:
Feel free to integrate it for us. :p (If you haven't tried, it ain't easy)

Walt

Interesting...! I ran it through Mathematica, I didn't try an explicit analytical solution. But it's certainly an interesting problem, I'll play with it a bit. The answer, according to Mathematica BTW is:

7.640395578055424035809524164342886583820
 
Pragmatist said:

Interesting...! I ran it through Mathematica, I didn't try an explicit analytical solution. But it's certainly an interesting problem, I'll play with it a bit. The answer, according to Mathematica BTW is:

7.640395578055424035809524164342886583820

As far as I know there is no closed-form solution for that.
 
jzs said:


As far as I know there is no closed-form solution for that.
OK, thanks. It seemed easy, and I thought for sure that CRC would have the solution to the integral, but it wasn't there. I rechecked my math and came up with the same integral, so I checked here.

I'll just tell him to run the numbers numerically, it's for a simulation exercise and an approximation would be fine. We just got to talking and wondered about an exact solution.
 
garys_2k said:

Thanks VERY much! If you could leave that up for about a week I can have him take a look at it.

Much appreciated! :)

Sure, no problem. :)

I forgot to put up my own picture of a cycloid, so here is one I got off the net:
cycloidmovie.gif
 
The integral is known as an "Elliptic E function"- its useful enough to have earned its own name...
 
garys_2k said:
A friend who helps design vehicles asked me how to estimate the length of a trip travelled on a sinusoidally "bumpy" road. Hmm, so how long would a sine be?

If you had an x-axis 2*pi long, and impressed on it a sine of unit height (peak at +/- 1), what would the length of the wave be for a bug crawling along it? I can't work out the integral, it gets bogged into forms I can't resolve, but this is one of those problems that seems like it should be easy.

I did a quick numerical analysis and got 2.43*pi, but is there an exact answer?

I know it's not really the point of your topic, but on a side note;
In the field of road maintenance for (usually very) poor roads we have used a device that measures this 'length' to compare it with apparent distance and give a figure for 'road roughness'. I'm not sure if it still gets used anywhere, it's main benefit over more detailed diagnostic tools was that it could be knocked up with a few easy-to-get parts and any old 2 axle vehicle.

If you need to get one for your project here, they are still available. :D
 
Ahh fair enough, it was just a thought. It's been a while since I did all this ;).
 
Tez said:
The integral is known as an "Elliptic E function"- its useful enough to have earned its own name...
Right, what he said.

Just to be precise, the length of our "unit sine curve" over the full 2 pi is

4 Sqrt(2) EllipticE(1/2) = 7.6403...

(You gotta love Mathematica, even if the guy who created it has gone off the deep end...)
 
This reminds me of a long-distance ride I was vetting at. When the riders came in to the finish they were all bitching like fury about the length of the last mile, which seemed to go on forever.

The reason? The 25 miles had been measured out on the map. Then the day before the ride they'd sent out a guy on a motorcycle to put up the markers, one every mile. He'd done what he was told, every time his odometer read another mile, he'd stopped and fixed a marker. Trouble was, he was going up and down the hills, and he'd done 24 miles some distance before he'd really reached a mile from the finish!

Rolfe.
 

Back
Top Bottom