Trouble getting loop to break

Fredrik Johansson fredrik.johansson at gmail.com
Sun Nov 25 13:32:34 EST 2007


On Nov 25, 2007 2:47 PM, Dick Moores <rdm at rcblue.com> wrote:
> Wow. your f() is ingenious, Frederik. Thanks very much.
>
> Any more tricks up your sleeve? You did say a post or so ago,
> "Further improvements are possible."

The next improvement would be to find a recurrence formula for the
terms instead of computing them directly. So for example, if summing
over c[n] = x**n / n!, instead of computing c[n] = x**n / factorial(n)
for each n, you'd compute c[0] and then just do c[n] = c[n-1] * x / n
for each of the remaining terms.

Fredrik



More information about the Python-list mailing list