# Crazy incredible log equation

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.

• Can you share the source of the problem? Also, I'm assuming you are defining $\log x = \log_{10} x$. – Toby Mak Aug 23 at 7:11
• This screams for numerical solution ... – Hagen von Eitzen Aug 23 at 7:27
• How are the several symbols defined? For example, is $i$ the imaginary unit or not? Are we dealing with real numbers alone or not? What other things do you know about the quantities involved. This may be important. – Allawonder Aug 23 at 8:11
• @Cesareo, how to do it? This is my whole problem. Please, explain :) – Dmitriy Stennikov Aug 23 at 8:31
• Chuck it into C my good lad. – rodger_kicks Aug 23 at 8:53

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.

$$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)}$$

• How does this help ? – Yves Daoust Aug 23 at 8:57
• What is the benefit of transforming the equation before using Newton ? – Yves Daoust Aug 23 at 9:08