bisection method: Simulating a retirement fund

Carl Banks pavlovevidence at
Fri Sep 3 20:28:07 CEST 2010

On Sep 2, 1:37 pm, Baba <raoul... at> wrote:
> level: beginner

In this economy, simulating the value of retirement funds with
bisection is easy.  Look:

def retirement_fund_value(n_years,initial_value):
    for i in xrange(n_years):
        value /= 2  # <- bisect value of fund
    return value

Carl Banks

More information about the Python-list mailing list