# How does this calculator work?

January 16, 2009 12:28 PM Subscribe

How do mortgage calculations work?

As an always-have-been-and-always-will-be renter, I've been free to ignore mortgages and how they're calculated. But now, for work, I need to understand how they're calculated. Specifically, I need to understand how the mortgage calculator on this page works:

https://www.uamc.com/locator/Calculators (select "What Will My Monthly Payments Be?" on the left panel)

Can this be distilled down to a mathematical equation that a programmer on my team would understand?

This is in California, if it makes a difference.

As an always-have-been-and-always-will-be renter, I've been free to ignore mortgages and how they're calculated. But now, for work, I need to understand how they're calculated. Specifically, I need to understand how the mortgage calculator on this page works:

https://www.uamc.com/locator/Calculators (select "What Will My Monthly Payments Be?" on the left panel)

Can this be distilled down to a mathematical equation that a programmer on my team would understand?

This is in California, if it makes a difference.

This page explains how to calculate an amortization table.

posted by bensherman at 1:06 PM on January 16, 2009

posted by bensherman at 1:06 PM on January 16, 2009

This is an ActionScript payment function I wrote a while back. It jives with other online calculators:

For instance, if you calculated the payment on a $100,000 30 year loan at 5%, paid monthly, it would look like this:

That would return 536.82. The calculator you reference rounds up to 537.

The tax and property insurance would just be added together, divided by 12, and added to the payment amount calculated by the function.

I don't know how they are calculating the mortgage insurance cost. It is likely just a percentage of the principal.

posted by thinman at 3:46 PM on January 16, 2009

public static function pmt(P:Number, r:Number, n:Number, t:Number):Number

{

// Loan Payments

// P: Principal borrowed

// r: APR expressed as a decimal

// n: number of payments per year

// t: total term of loan in years

r /= n; // Interest rate applied per billing cycle

return P * (r+r/(Math.pow(1+r, n*t)-1));

}

For instance, if you calculated the payment on a $100,000 30 year loan at 5%, paid monthly, it would look like this:

var monthlyPayment:Number = pmt(100000, .05, 12, 30);

That would return 536.82. The calculator you reference rounds up to 537.

The tax and property insurance would just be added together, divided by 12, and added to the payment amount calculated by the function.

I don't know how they are calculating the mortgage insurance cost. It is likely just a percentage of the principal.

posted by thinman at 3:46 PM on January 16, 2009

« Older [relationship filter] Boyfriend is just not that... | I don't wanna Jack Off In Back. It's baroque but... Newer »

This thread is closed to new comments.

posted by OmieWise at 12:45 PM on January 16, 2009