|
|
|
|
|
by excessive
2433 days ago
|
|
Here is one in Python. Uncomment the if statement if you want it to terminate. def sin(x):
def recur(x, n, s, p, f):
#if n > 9: return s;
return recur(x, n + 2, s + p/f, -p*x*x, f*(n + 1)*(n + 2))
return recur(x, 1, 0, x, 1)
Of course maybe it's cheating from your intent because it's really just implementing the Taylor series, and it has too many arguments. I believe any analytic function could be defined this way if you can figure out the pattern for its derivatives. |
|