Break-Even Rate
A project costs money now and pays back later: flows[0] is negative, every later flow is positive or zero, and flows[t] arrives after t years. Its value at yearly rate r is the sum of flows[t] / (1 + r)**t. Return the rate, between -0.9 and 10, at which that value is exactly 0. Answers within 0.00001 of the right one are accepted.
Example 1
flows [-100,110]
returns 0.1
100 now for 110 in a year is a 10% return.
Constraints
2 <= len(flows) <= 12- The value is positive at -0.9 and negative at 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Cheapest PairingMedium
- Do the Groups DifferMedium
- Fit the DecayMedium
- Is the Mean DifferentMedium
- Lowest PointMedium
- Nearest Point to Each QueryMedium
- Range for the MeanMedium
- Two Groups ComparedMedium