The main challenge does not stem from the mathematical formula but from the cash flows to be considered for EIR calculations:

The solution has to calculate the amortisation plan over the complete lifecycle of a deal and to provide separate amounts for all relevant cash flows, including

A further challenge is to know when the EIR has to be recalculated: