8 Replies Latest reply on Nov 28, 2015 3:14 AM by hjgunn@mmedia.is

# [XPOST]How to program Newton / Raphes in Filemaker?

At this time I have created a solution that uses the bisection method to calculate the EARP of a loan.

This method takes about 35 iterations to come up with an answer.

So I would like to do these calculations using either the Newton / Raphes method or one of the Quasi Newton methods.

I believe those methods use around 5 iterations to come up with a fairly accurate solution.

Is there anyone here that has done this in Filemaker or that could show me how it's done?

Also, how can I prevent the calculation from not converging?

Kind regards

Hans

• ###### 1. Re: [XPOST]How to program Newton / Raphes in Filemaker?

Recursive custom function will do it.

Doesn't financial functions give you enough calculations for loan?

• ###### 2. Re: [XPOST]How to program Newton / Raphes in Filemaker?

"Recursive custom function will do it."

I'm no good at recursive custom functions so I wrote a script.   :-)

"Doesn't financial functions give you enough calculations for loan?"

I'm not calculating a loan, I'm calculating the EAPR for a loan.

So far I have not found any financial functions in Filemaker that does anything like this. And actually there are only four of them.

It may be that I'm calculating a similar thing as the NPV function only that in my case the Interest rate is the unknown variable.

Actually I seem to have built this functionality using the records of a previously created payment schedule rather than the slots of a repeating field.

I'm attempting to solve the following formula using using Newton / Raphes :

Sum [L = 1 to M] of D(1 + X)^(-S), for the value of X.

• ###### 3. Re: [XPOST]How to program Newton / Raphes in Filemaker?

I don't see L in your formula, so read the previous post. But I forgot mathing, not sure the "Newton" can be applied to the formula (it has x^(a/b) in denominator).

• ###### 4. Re: [XPOST]How to program Newton / Raphes in Filemaker?

briandunning.com is always a good starting point when it comes to custom functions:

FileMaker Custom Function:IRR ( cashFlowsList ; guessRate )

• ###### 5. Re: [XPOST]How to program Newton / Raphes in Filemaker?

This is the actual formula I'm working with.

L= 1 is under the summary in the right hand formula.

Solving it for X would involve using Root solving methods, where of there are several, two of them being Bisection and Newton Raphes. Additional being Quasi Newton methods and others.

To use Newton I would need the derivative, which I suspect would be something in the direction of S* (1+x)^S-1

S again would be something like (Days / DaysInYear) + MonthsUntilMonthOfPayment / 12)

However,  once it comes to solving the formula, S will be a fully calculated number and no longer the formula for S.

But I still have to figure out the actual derivative. I haven't gotten around to that yet.

• ###### 6. Re: [XPOST]How to program Newton / Raphes in Filemaker?

http://www.creditunion.ie/files/file_20050316024652OFT%20-%20Credit%20Charges%20and%20APR.pdf

says

APR = 100*((1+IRR)^freq-1)

But indeed, I don't know what EARP is Do you want APR?

• ###### 7. Re: [XPOST]How to program Newton / Raphes in Filemaker?

EAPR is similar to APR with occurred cost added before calculating the value.

It seems that many references use the term APR for what is actually the Nominal interest rate and EAPR for the Nominal interest rate including occurred cost. So that a loan of 100.000 with 7% interest rate could show an EAPR of for example 7,32% depending on the cost and the length of the loan. This number is then used to compare the actual cost of different loans.

• ###### 8. Re: [XPOST]How to program Newton / Raphes in Filemaker?

I owe you an apology...

I hadn't noticed until now that I wrote EARP instead of EAPR ( Extended Annual Percentage Rate ).

Hans