Simplifying Trig Equation (like Wolfram|Alpha does it…)
I have the equation
to produce the second curve I'm using to make a sinusoidal function that smoothly maps from 0 to 1. The range for y= needed to be [0.5, 1] and it seems to be correct.
Wolfram|Alpha tells me this is equivalent to ))
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.
http://dl.dropbox.com/u/1585739/sinusoidal.png
Grapher file if you are on Mac (Grapher comes free with most versions of OS X):
Download