I juggle, and then track the juggling balls.

juggling graph

I want to describe this juggling trick using sine waves. A metronome was used to keep the throws periodic. The video is 120fps, so there are 120 observations per second. The Y-values correspond to the location of the ball in the image. The video is 800 pixles tall, so the Y-values range from about 200 to 600. This is a graph of (the data):

423 graph

Using this Python/OpenCV script, was able to manually fit a sine wave to the data. The thick blue line is the source data. The thick green line is the manually fitted sine wave, which is composed of the two thinnest sine curves:

manually fitting a sine wave

From manually fitting the sine wave, I know that this function is the sum of two sine waves. The period of the longer wave is 2x the period of the shorter wave. A FFT seems to confirm this:


In conclusion, I can describe this data by manually (visually) fitting a sine curve. I would like to use a mathematical and statistical methods to fit a sine curve to this data.

The data that I used in this example was pretty simple, but the juggling tricks can get more complicated:

complicated trick

  • 1
    $\begingroup$ Why does it have to be a sine wave? $\endgroup$
    – Xetrov
    Nov 1, 2018 at 19:49
  • 2
    $\begingroup$ Fourier Analysis? $\endgroup$ Nov 1, 2018 at 19:57
  • 2
    $\begingroup$ The vertical position is of course a quadratic, and although oe could perform a Fourier analysis and synthesis, this seems like a very inelegant and unmotivated approach to describing the position. One could just as easily use triangle waves, or any other Fourier-complete basis. Why sines?? $\endgroup$ Nov 1, 2018 at 20:17
  • 2
    $\begingroup$ Very cool problem $\endgroup$
    – user3417
    Nov 2, 2018 at 1:40
  • $\begingroup$ @VortexYT I guess it doesn't have to be a sine wave, it just seems like a sine wave would be the most logical type of function. Ultimately, I will be using this to make animations, so all I really need to know is where the ball will be at time T. $\endgroup$ Nov 2, 2018 at 1:52

1 Answer 1


While the ball is in free motion its orbit is a parabola: the horizontal component is linear in time, and the vertical component quadratic during each free flying interval separately. But during the time you hold the ball in your hands we have no mathematical control of the happenings. At any rate a periodic process results whose period $T$ you define by your actions. Such a process can be Fourier analyzed, and you obtain expansions of the form
$$x(t)={a_0\over2}+\sum_{k=1}^\infty \left(a_k\cos{2k\pi t\over T}+b_k\sin{2k\pi t\over T}\right)\ ,\tag{1}$$ and similarly for $t\mapsto y(t)$. As an experienced juggler you try to make the process as "harmonic" as possible, and this results in a fast decrease of the coefficients $|a_k|$ and $|b_k|$, so that in $(1)$ only the first two or three terms really play a rôle.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .