I assume that you want to calculate X from your equation. This equation can be written as
f(y) = y + y**2 + y**3 + ... + y**N - L/P = 0
Where
X = APR L = Loan (6000) P = Individual Payment (274.11) N = Number of payments (24) F = Frequency (12 per year) y = 1 / ((1 + X)**(1/F)) (substitution to simplify the equation)
Now you need to solve the equation f(y) = 0 to get y . This can be done, for example, using Newton's iteration (pseudocode):
y = 1 (some plausible initial value) repeat dy = - f(y) / f'(y) y += dy until abs(dy) < eps
Derivative:
f'(y) = 1 + 2*y + 3*y**2 + ... + N*y**(N-1)
You must calculate f(y) and f'(y) using the Horner rule for polynomials to avoid exponentiation. A derivative can probably be approximated in several several terms. After you find y , you get X :
x = y**(-F) - 1
source share