There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Define two functions:
A(n, r) = (1 + r) ^ n
a(n, r) = (1  A(n, r)) / r if r != 0, n otherwise.
Here is n = number of periods, and r is the interestperunage per period (perunage, so when the interest rate = 2%, then r = 0.02).
A(n, r) and a(n, r) are, given n, monotone decreasing functions of r.
Now form this equation:
3,463.22 = 125 * a(32, r) + 21.22 * A(33, r)
To solve this for r with NewtonRaphson is possible, but the derivatives are not very attractive. So a simple iteration will suffice. Start with the interval of [0, .5], take r = 0.25 and when the RHS is bigger than the LHS, r is too low, and vice versa.
For a little background, see some info
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:hi Mike,
yes, there is some misunderstanding. I meant a simple binary search.
So,
Note that both functions A and a are present in Excel (and in LibreOffice), so you can either put that equation in excel, with r being some cell, and use target solving, or you can similarly put all the payments (33 of 'm) in a column, and again use target solving.
It's been years since I last did that in excel, so the exact details are a little vague now, but if you got the java code running, you can try to solve it with a spreadsheet, see if you get the same results.
Blitzlügen  Lies or information broadcast, but when called out the broadcaster does little or nothing is done to correct them, thus allowing those who wish to believe to accept them as truth.
Lügensturm  A barrage of Blitzlügen fired in such quick succession that it is essentially impossible to correct them all.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:hi Mike,
first an apology: I wrote in the code snippet
which of course is a blunder, Should be:
I don't know how you obtained a percentage of over 24, that is way more than I get.
This is the code that I used:
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:The formula that calculates loopResult must be changed a little.
You see, the timeunit is 14 days, but the payments are all done on a timeunit + .5. The first payment takes place at 1.5 (ie 21 days), the second at 2.5, et cetera, and the final payments at 26.5. Did I understand correctly?
The loopResult must now be calculated as:
and I get
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:With that percentage (13....), the loan should be 2787.68, instead of 2995.
I can only guess that our assumptions about times of paying differ.
But you're welcome.
Mike London wrote:What the client wants is APR calculated via biweekly, not the annual APR.
Blitzlügen  Lies or information broadcast, but when called out the broadcaster does little or nothing is done to correct them, thus allowing those who wish to believe to accept them as truth.
Lügensturm  A barrage of Blitzlügen fired in such quick succession that it is essentially impossible to correct them all.
You are allowed to make typical assumptions, e.g. loan taken out of 31st December and first payment on 14th January, then every two weeks exactly, and exactly fifty‑two weeks in the year. The rules for predicting an APR also allow you to overestimate the APR by ≤ 1.0% and underestimate by ≤ 0.1%. That is to allow for the fact that one cannot predict every repayment schedule in advance. You can predict bi weekly payments by using a weekly schedule with alternate payments of 0.00.Tim Holloway wrote:. . . a year isn't an exact number of weeks long. . . .
Campbell Ritchie wrote:
You are allowed to make typical assumptions, e.g. loan taken out of 31st December and first payment on 14th January, then every two weeks exactly, and exactly fifty‑two weeks in the year. The rules for predicting an APR also allow you to overestimate the APR by ≤ 1.0% and underestimate by ≤ 0.1%. That is to allow for the fact that one cannot predict every repayment schedule in advance. You can predict bi weekly payments by using a weekly schedule with alternate payments of 0.00.Tim Holloway wrote:. . . a year isn't an exact number of weeks long. . . .
Piet Souris wrote:Well, I screwed up and you are right. I apologize
I calvculated the 14 days interest rate r, (noting wrong with that), but then I calculated the year rate as (1 + r) ^12  1, i.e. as if the period was months, instead of 14 days.
So the outcomes I got now are:
interest per period r: 0.005153656005859375
interest on yearbasis: 0.1429937945220212 // (1 + r) ^26  1
int on year: 0.13399505615234375 // 26 * r
There are three kinds of actuaries: those who can count, and those who can't.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:hi Mike,
I was teaching a course "Introduction to Actuarial Mathematics" in the 90's, and the first three months were all about loans and determining their values at any time. And in general, people did not find that easy.
The principle is always: the present value of past and future income is always equal to the present value of past and future outgo.
So, it boils down to determining the present value. The two formulas I presented simplify this often.
In the first exercise, with a normal biweekly payment, the present value (PV) of the outgo is the loan, the PV of the income = payment * a + restPayment * A. Iterating, we get the value of the interest rate for this biweekly period.
The second example was a little bit more challenging. The outgo is still the loan, at t = 0, the income is at times 1.5, 2.5,... 26.5. These are not integer times, so what I did was to determine the PV at time t = 0.5. We get the same formula as in the first exercise. But now we have an outgo PV at t = 0, and an income PV at t = .5. To remedy this, I discounted the income PV over a half timeunit to t = 0.
Calculating the APR is now a triviality. I take a frequency of 26 payments in a year. Now, there are two APRs involved. If r = interestperunage per timeunit (2 weeks), then what we call the real APR = (1 + r) ^26  1.
However, to the public the so called apparent APR is reported, and that is simply 26 * r. Guess which of the two is lower...
This is what you can expect in your quest for more knowledge. But I found this always very nice maths.
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filleradvertising
