This was inspired by a blog entry I made about home buying. My original goal was to work through a set of calculations about the merits of renting vs buying. After several discussions with various people about the topic, I decided I should automate the calculations.
As far as I know, all of the calculations here are correct, but I can't guarantee anything. Get some proper advice from a financial planner (while keeping in mind any economic factors that might influence their advice).
One thing that is clear: I haven't done inflation right. I was trying to keep everything in current-dollars (i.e. ignore inflation). But, the mortgage payment (at least) is inherently affected by inflation (it decreases in inflation-adjusted value since the dollar amount stays the same).
Summary
Buying
Buy a house worth $??? with a total monthly payment of $???. You expect it to be worth $??? after ??? years.
Renting
Rent a place for $??? and invest $??? per month. You expect this to be worth $??? after ??? years.