Problems with calculating the proper compounding



Hello,

I'm creating a spread*** that automatically determines the payment
amount for a mortgage.

The problem that I'm running into is that when the compounding for the
interest rate is different from that of the payment frequency, I'm not
calculating the equivalent rate correctly.

For example:

J12 = 5.75%
Monthly payments
Amortization = 40
n = 40 * 12 = 480

PV
PMT = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 - (1 + (J1/12) ) ^ (-n))
~~~~~~~~~~~~~~~~~~
(J1/12)

^ = exponent

I do that, and then I input J1 instead of J12.

It calculates it very closely, but I know that I'm doing something
wrong.

Can someone please tell me?
.