Do you have any buddies that know math? Can you get one of them to write you the equations that are needed.
Once you have the equations and need help coding them, post the equations and the code...