jagomaniak wrote:
> I'm using the following series:
> 
> sin x = x - x^3/3! + x^5/5! - x^7/7!...
> 
> However, I'm unsure how to convert it to a function in my program.

Break it down into simpler parts.  Mathematical formulas require more 
effort to convert into C/C++ (and other languages).  Start with 
expanding the formula to something that can be implemented more easily 
in a computer program:

sin x = x - x^3/3! + x^5/5! - x^7/7!...

sin x = x + (-1 * (x^3/3!)) + (1 * (x^5/5!)) + (-1 * (x^7/7!))...

That should reveal a pattern.  Next, break down the formula into its 
constituent components.  Basically, this is a homework exercise in 
whether or not you can break down a problem (or, in this case, a 
mathematical formula) into its component pieces and create a plan that 
you translate into code that ultimate solves the problem.  This is a 
skill you have to develop pretty much on your own.

Side note:  Taylor Series are typically taught at college level math, 
although any trigonometry student could handle them as well.  For 
whatever reason, students these days are left hanging trying to 
understand how the sin/cos key on their calculators work until they get 
into Calc II in college.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to