1) Upgrade the Function to a Maths
I'm not sure with this, function it's enough complex for me to keep it a while, upgrade to maths make me a bit scare. Sure maybe in a future when I feel more comfortable. For now, I try to learn and discover.
-- nokulture
I had the same feeling about Maths, but this tutorial completely changed my mind: