According to this site the arc length of the curve $y = f(x)$ from $x=a$ to $x=b$ is given by:
$$\operatorname{length}_{ab} = {\large\int}_a^b \!\sqrt{1+\left(\frac{dy}{dx}\right)^2}\,dx.$$
So, we got a sine wave function which is
$$y = \left. A\sin (Fx + P) \right|_{x=a}^b.$$
the length of this is
$$\operatorname{length}_{\text{sine}} = \int_a^b \sqrt{1+(AF\cos(Fx))^2}\,dx $$
Example of this is in first link or here:
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 = 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!
Best Answer
The derivative of $A\sin(Fx+P)$ is $AF\cos(Fx+P)$. Also, you want to integrate, so it is integral from $a$ to $b$.