I've written a program in which I'm using a compounding calculator to determine an output. But without a formula I'm having trouble reversing the calculation.
Given a compounding problem whose variables are:
i: initial amount (eg: 2000),
d: divisor (each round, eg: 3),
r: return amount (eg: 0.15),
f: final amount (the return of all divisions)
Note: Unlike interest formulas, we don't know the number of "rounds" or times it will be compounded because that's determined by how much the return rate is gives us back each round.
It's simple enough given i, r, and d to calculate f with this code:
for i >= d {
f += i/d
i = i*r
}
Example might be:
i = 2134
d = 4
r = 0.15
f = 627
some ancillary outputs:
- the amount returned from r: 376 (17.62% of input)
- i remainder from final division: 2
I don't know how to express this in a mathematic formula, so the iterative approach is all I can do. And because of that, given r, d, and f, I cannot figure out how to calculate i which is important to the problem at hand.