I take a cash advance of 'amount' from my credit card, paying an up-front 'fee' (given as a percentage), with a promotional rate 'int' for time 'len'. I must pay at least 'min'% of the owed amount monthly.
I put 'amount' into an investment account earning 'p'% interest, and also make the monthly payments from this account.
Question: for what value of 'p' will I break even after time 'len'?
Here's how I set it up in Mathematica:
DSolve[{
(* I start off owing amount plus the fee *)
owed[0] == amount*(1+fee),
(* The amount I owe increases due to credit card interest,
but decreases due to monthly payments *)
owed'[t] == int*owed[t]-min*12*owed[t],
(* I start off having amount *)
have[0] == amount,
(* The amount I have increases due to investment interest,
but decreases due to monthly payments *)
have'[t] == p*have[t]-min*12*owed[t],
(* After len, I want to break even *)
owed[len] == have[len]
},
{owed[t], have[t]}, {t}]
Mathematica returns "DSolve::bvnul: For some branches of the general solution, the given boundary conditions lead to an empty solution", which is actually reasonable: there's only one value of 'p' that will yield a solution for the differential equations above.
How do I coerce Mathematica into finding this value?
I tried solving for owed[t], then substituting owed[t] into have[t], and then solving owed[len] == have[len], but this yield a similar error. Running Reduce on "owed[len] == have[len]" yielded something complex and ugly.
The equation:
owed'[t] == int owed[t]-min 12 owed[t]
if both int and min are constants, is just a exponential function. With the initial condition
owed[0] == amount*(1 + fee)
gives
owed[t_] := amount E^((int - 12 min) t) (1 + fee)
And that's the solution for owed[t]
Now for have[t] you may use:
DSolve[{
have'[t] == p*have[t] - min*12*owed[t],
have[len] == owed[len]},
{have[t]}, {t}]
That gives you the expression for have[t] that meets your break even condition.
For obtaining the value of p, you must use the last equation:
have[0] == amount
or, after replacing have[0] for it's value:
(amount E^(-len p) (1 + fee) (12 E^(len p) min +
E^(len (int - 12 min)) (-int + p)))/(-int + 12 min + p) == amount
This last equation seems not easily solved for p. I tried a few things (not too much, certainly) and it resists strong.
But ... given numerical values for the rest of the parameters is trivially solved by any numerical method (I guess)