0

How can I calculate the root mean square error of two functions like

\begin{align*} f(x) &= \sin(x)\\ g(x) &= x-\frac{1}{6}x^3 \end{align*}

in $[0, 2\pi]$ range?

Shaun
  • 44,997

1 Answers1

1

You need to use an integral, as we are now dealing with infinitely many points. Thus we have $$\sqrt{\frac{\int_0^{2\pi}(\sin(x)-(x-\frac{1}{6}x^3))^2dx}{\int_0^{2\pi}dx}}$$ The square root of the mean square of the difference between the two functions.

Isaac Browne
  • 8,076
  • heh I don't know how to calculate this – Shinzoo May 14 '17 at 13:41
  • http://www.wolframalpha.com/input/?i=sqrt((integrate+(sin(x)+-+(x+-+(1%2F6)*x%5E3))%5E2+from+0+to+2pi)+%2F+(integrate+x+from+0+to+2pi)) I use this, but it is "incorrect" i gues – Shinzoo May 14 '17 at 14:04
  • Yes, that is incorrect, because you are just taking the square root of the integral. Not even an average difference, never-mind the average square of the difference. The root mean square error is the square root of the average square of the difference. Thus the above method is the correct way of doing it. – Isaac Browne May 14 '17 at 18:07
  • Also, if you are having trouble calculating, I suggest plugging it into WolframAlpha, as you did with your method. – Isaac Browne May 14 '17 at 18:09