Payment calculations for fixed rate loans (Excel PMT func?)


I need the Ruby equivalent of the Excel PMT function which will
calculate a monthly payment amount given an interest rate, a number of
months, and a present value of the loan amount.

Anyone know where I can find such a beast?

If someone can point me to the formula that Excel uses internally,
that’s fine too. I know it isn’t very complicated, but I def. don’t
know it off hand.