Well, a sine wave is not a fractal, for one...
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. Function sine(x As Double, Optional term, Optional p = 1#) As Double
If IsMissing(term) Then
term = x
End If
If term <> 0 Then
sine = term + sine(x, -term * x / (p + 1) * x / (p + 2), p + 2)
End If
End Function
Edit:
This is my interpretation of the Taylor series approximation, but it's probably a bad idea to use this for anything that matters. One reason is that it doesn't reduce large angles, and another is that people who know what they're doing prefer to use some other formula, from a cursory Googling...though I'm not sure why.