How length of sine wave is calculated?

Luk4

New member
Joined
Oct 2, 2013
Messages
5
Hi!
According to a - site the arc length of the curve y = f(x) from x=a to x=b is given by:


length_ab = Derivative_ab( Sqrt ( 1 + (dy/dx) ^ 2 ) dx)


So, we got a sine wave function which is


y = A * sin (F * x + P) from x=a to x=b


the length of this is


length_sine = Derivative_ab( Sqrt ( 1 + (A * F * cos (F * x)^2 dx)


Example of this is in first link or here:


http://www.wolframalpha.com/input/?i=tell+me+the+arc+length+of+y+=+1.35*sin(0.589x)+from+x+=+0+to+10.67


Now, my question is what is the algorithm to compute length for specified x=a to x=b. For example, let's say:


step 1) set length = 0;
step 2) for x = a to x = b {
increase x by 0.01;
length += derivative(x);
}
step 3) return length;


I have implemented such a function, but it gives me the wrong length according to wolfram. Is it because of the increasing x or wrong derivative function?


Thanks in advance!
Regards!
 
Last edited by a moderator:
Hi!
According to this site arc length of the curve y = f(x) from x=a to x=b is given by:

length_ab = Integral_a^b( Sqrt ( 1 + (dy/dx) ^ 2 ) dx)

So, we got a sine wave function which is

y = A * sin (F * x + P) from x=a to x=b

the length of this is

length_sine = Integral_a^b( Sqrt ( 1 + (A * F * cos (F * x)^2 dx)

Example of this is in first link or here:

http://www.wolframalpha.com/input/?i=tell+me+the+arc+length+of+y+=+1.35*sin(0.589x)+from+x+=+0+to+10.67

Now, my question is what is the algorithm to compute length for specified x=a to x=b. For example, let's say:

This is a numerical integration routine that is actually a right-hand Rieman sum
step 1) set length = 0;
step 2) for x = a to x = b {
increase x by 0.01;
length += derivative(x);...What are you using for this function?
.......................................Does it include multiplying by 0.01?
}
step 3) return length;

I have implemented such a function, but it gives me the wrong length according to wolfram. Is it because of the increasing x or wrong derivative function?

Thanks in advance!
Regards!
You used the word "derivative" where you should have used "integral" two places above. The proper formula is

\(\displaystyle \displaystyle \int_a^b\left[1 + \left(\frac{dy}{dx}\right)^2\right]^{1/2} dx\)

\(\displaystyle y = A\ \sin (F\ x + P) \),.....\(\displaystyle \dfrac{dy}{dx} = A\ F\ \cos(F\ x + P) \)

\(\displaystyle \displaystyle \int_a^b\left[1 + A^2\ F^2\ \cos^2(F\ x + P)\right]^{1/2}\ dx \)

Does the procedure you call "derivative" calculate this integrand (including dx)? If so, your numerical method should be close to the true value of the integral.
 
Last edited by a moderator:
You used the word "derivative" where you should have used "integral" two places above. The proper formula is

\(\displaystyle \displaystyle \int_a^b\left[1 + \left(\frac{dy}{dx}\right)^2\right]^{1/2} dx\)

\(\displaystyle y = A\ \sin (F\ x + P) \),.....\(\displaystyle \dfrac{dy}{dx} = A\ F\ \cos(F\ x + P) \)

\(\displaystyle \displaystyle \int_a^b\left[1 + A^2\ F^2\ \cos^2(F\ x + P)\right]^{1/2}\ dx \)

Does the procedure you call "derivative" calculate this integrand (including dx)? If so, your numerical method should be close to the true value of the integral.

First of all I would like to thank You very much for the help & answer! As You noticed I have mistyped "derivative" with "integral", sorry for that. Yes, the procedure called "derivative" look like this:

public double Derivative(double x)
{
return Math.Sqrt(1 + Pow(P * A * Math.Cos(P * x)));
}

But it gives me large number for small x and small values for large x. I think it is because of increasing x hm. I'm stuck on this. Could You give me a hint or something?

Thanks in advance!
Regards!

p.s i have ignored dx because wolfram is saying that d / dx * x = 1 (attachment). Is it right?WolframAlpha--derivative_of_y___1_35_sin_0_589x_2___Result__2013_10_03_0257.jpg
 
Last edited:
Ok, I have found how to fit my sine curve. I have done it by adding delta y between those two vectors into the value of found sine function (blue). However, the sine wave which is now fitted between points is a little bit different (violet). I got a question for all you experts, does it affect the length of sine wave which i found or the length of the original and "moved" curves are the same? Here is the image

krzywe_dopasowane.jpg
 
Awesome Content!! Thank for providing excellent information. Actually quite helpful data accessible here.
 
Last edited by a moderator:
Top