Crazy incredible log equation

140 Views Asked by At

Sorry for the possibly stupid question. But I can't solve this equation. I'm need to find X from:

$$N = \frac{\log(\frac{Bd-X}{Ad-X})}{\log(D)} - \frac{\log(1-\frac{Bi}{P+X})}{\log(I)}$$

I don't know how to kill log in this equation.

This is a credit card loan analysis problem.

$A$ - the loan Amount (initial loan balance, $B_0$)
$N$ - the total Number of payments/periods/month for the entire loan (from $B_0$ till $B_N$)
$B_n$ - the Balance after n payments have been made
$i$ - the Interest rate per period, not per year, $0 < i < 1$
$p$ - the Payment rate, $0 < p < 1$, $i <= p$
$P$ - the min. Payment amount
Actual payment for loan (of this type) $Payment = MIN(A*p ; P)$
$X$ - additional eXtra payment
$B$ - loan balance at some "threshold point" $B_t = P/p$

When loan balance $B_n > B_t$ then payment $=B_n*p$ and number of periods: $$N_{B_n>B_t} = \frac{\log(\frac{Bd-X}{Ad-X})}{\log(D)}$$ When loan balance $B_n <= B_t$ then payment $=P$ and number of periods: $$N_{B_n<=B_t}=-\frac{\log(1-\frac{Bi}{P+X})}{\log(I)}$$ $$N = N_{B_n>B_t} + N_{B_n<=B_t}$$

Variable Replacements:
$I = 1 + i$, $1 < I < 2$
$d = i - p$, $-1 < d < 0$
$D = 1 + i - p$, $0 < D < 1$

$log$ base is $10$ but I can replace it with $e$ or anything else.
Please send me in the right direction.
Thanks in advance.

2

There are 2 best solutions below

0
On

By a combination of homography and antilogarithms, you can turn this equation to the form

$$t^a(rt+1)=pt+q$$ where the unknown is $t$.

The details are unimportant, this is just to show that except for a few very specific cases (such as $a=1,2,3$), there is no analytical solution. You need to use a numerical solver.

2
On

$$ N = \log\left(\left(\frac{Bd-X}{Ad-X}\right)^{\frac{1}{\log D}}/\left(1-\frac{Bi}{P+X}\right)^{\frac{1}{\log I}}\right) $$

or

$$ 10^{N\log D} = \left(\frac{Bd-X}{Ad-X}\right)/\left(1-\frac{Bi}{P+X}\right)^{\log_D I} $$

or

$$ 10^N D = \frac{\frac{Bd-X}{Ad-X}}{\left(1-\frac{Bi}{P+X}\right)^{\log_D I}} $$

or

$$ f(X)=\alpha\left(1-\frac{Bi}{P+X}\right)^{\beta} -\frac{Bd-X}{Ad-X} = 0 $$

This equation can be solved numerically by using an iterative process like Newton's in which

$$ X_{k+1} = X_k - \frac{F(X_k)}{F'(X_k)} $$