Here is another (related) GPS method which uses the aircraft's heading as opposed to the track method used by the NTPS approach. It is fun to watch as it iterates to find the answer. Math details and the source code are also available on the site.
http://www.reacomp.com/
Hank