-
tangent recursion
im just curuios but the book im using only shows you how to do a recursive sine function... how the heck would you do a tangent function, with its mathematical approximation ? like, here:
http://en.wikipedia.org/wiki/Taylor_...mmon_functions
anyone have code online regarding this?
-
I guess at some point, you need to start trying stuff for yourself rather than assuming you can find an example either in a book or online.
-
I thought that if you already the mathematical formula with the Epsilon addition operator, that the rest would be trivial. I mean, getting from the epsilon notation to a for() or even recursion is nearly automatic:
Code:
Epsilon(1, infinity) f(x)
equals
sum = 0;
for(x = 1; x < infinity; x++)
sum += f(x)
equals
sum = 0;
while (x < infinity)
sum += f(x++)
equals
function sum(x)
return f(x) + sum(x+1)
Change the above code slightly to add stop conditions and you're done.