# Financial, Multiple Compound Interest Problem

DKATyler
I am currently attempting to solve the following problem for a calculator I am constructing in Java.
Company 1 pays A% Interest every T days
Company 2 pays B% Interest (>A%) every T days

Company 1 has an initial investment of $X dollars Company 2 requires an inital fee of$Y dollars to invest in their company ($Y does not pay any interest! It's a fee.) At what point T in terms of A, B, X and Y should I stop investing in Company 1 and begin investing in Company 2 to obtain the maximum return at T=infinity? Investments are non-refundable. Example:$1,000 invested in A at 3% interest
B pays 8% interest
B requires a $1,000 fee to invest. By brute force calculation, the optimum T value is approx 16 for this example. ($1604.71 invested in Company 1). This results in the first interest earning investment in B at T=39. (Only slightly later then T=0 with \$1000 in company where the first interest earning payment would be made at T=36).

## Answers and Replies

Mentor
2021 Award
This is a linear optimization and the simplex algorithm should do. However, if ##T## tends to infinity, there will never occur a ROI.