bisection method: Simulating a retirement fund
Baba
raoulbia at gmail.com
Fri Sep 3 04:06:14 EDT 2010
On Sep 2, 11:10 pm, MRAB <pyt... at mrabarnett.plus.com> wrote:
>
> Why are you saving 'fund' in SavingsRecord if you're returning just the
> last and discarding others? Basically you're returning the final value
> of fund.
Hi MRAB
ok i agree that this is not be ideal. I should shorten this to ONLY
return SavingsRecord[-1]
> When performing this type of 'search' make sure that the interval (high
> - low) reduces at every step. > (integer division) and if the 'if' condition happens to be false
> then the value of 'low' won't change for the next iteration, leading to an infinite loop.
If you look at the output you will see that the interval DOES seem to
reduce at each interval as expenses and fundsize reduce gradually. The
computation does not lead to an infinite loop.
tnx
Baba
More information about the Python-list
mailing list