Ok, so now that i have time, i will write down how i came up with the idea.
It was while i was preparing for my physics exam (i never read the textbook before, this was my first time ), one of the chapters in our textbook talks about simply harmonic motion.
Now, a simply harmonic motion (sorry if the naming is wrong, but you know it hard to get the right word in English), the force must always be in opposite direction of displacement, and must be proportional to distance between the object and the
point of equilibrum.
At that point, i tried to think, what is the different between the simple harmonic motion in half a cycle, and the motion of an object in ballestic trajectory (ignoring air resistance).
I tried to think, i reached the conclusion that it must be something related to in which part of the motion the biggest part of change in speed happen.
I thought, a graph would make everything clearer, so, i tried to graph the motion of a balestic (moving upwards) and simply harmonic motion in half a cycle (distance versus time graph), with the same heighest point, and the same time interval.
As we know, the motion of an object moving upwards under the effect of gravity in a distance versus time graph is actually a parabola (not sure of the naming, but it can be written as ax
2+bx+c).
So, i took 3 test points, to make my two graphs.
(0,0)
(π/2,1)
(π,0)
So, i made a function, called f(x), defined on the interval [0,π]
f(x)=ax
2+bx+c
f(0)=0
f(π/2)=1
f(π)=0
I then solved to get the values of a,b and c.
from the first equation, c=0
from third equation, a=-b/π
solve with second equation, b=4/π
and, a=-4/π
2
Now, i graphed my f(x) on [0,π] and sin(x) on the same interval, they looked very similar (and i was able to figure out the difference between the two types of motion).
My next step, to make my f(x) the same as cos(x) on other intevals.
Now, on the interval [π,2π] is the same as on [0,π], except it will be
shifted π to the right, and it will be inverted (or, in other words, multiplied by -1).
So, on the interval [π,2π] -f(x-π) will almost match sin(x) on the same interval, and so on ...
Now, i needed a way to the -π jumps each time x gets π bigger.
I thought, if i found an integer that gets bigger by 1 each time x gets π bigger, i will only need to multiply it by π.
And [ x/π ] is what i needed, this function gets bigger by 1 each time x gets bigger by π (and on steps).
So, the function f(x-π[ x /π ]) is almost what we need, it oscilates, and a new half cycle starts every nπ, the only problem is getting it up and down.
We need it up when x is in [ 2nπ, 2nπ + π] and down when x is in [ 2nπ + π, 2nπ + 2π ].
I have been taught the trick of -1
n (yes, i was taught it, this is the only thing that i didn't think of), when n is odd the result is -1, when n is even the result is 1.
So, my last function was -1
[ x/π ]f(x-π[ x/π ]), where f(x) = ax
2+bx+c, and a=-4/π
2, b=4/π , c=0.
The version of the equation you see in my first post is a simplified one.
If you have any questions or comment, please feel free to tell them

.
Thanks for your time all.