I looked at all the trig equations on Wikipedia to try refreshing my Trig knowledge and got enough to transpose the basic sine curve into the form I need it. I can't work out the steps to simplify my equation to the answer Wolfram|Alpha provided though.

As far as my Javascript program goes, it don't ?think one expression is going to cost any more than the other, but given the large number of times it needs to calculate the function (1000 points * 60 frames/sec) every bit counts. Any pointers gladly received! I'm interested on how a program can do that crunching to a simpler expression and how many steps it involves.

In the image below, I'm use the Orange curve function for range of x=[0, 0.5) and the Purple curve function for range x=[0.5, 1] to make a composite function.

If anybody has any experience with Grapher, i would like to know how to limit the range of a function being plotted to a sub-section of the curve. It's a pretty powerful 2D/3D animated plotter, if people haven't seen it, check it.