help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: distance from Easter Island to Chile


From: giacomo . boffi
Subject: Re: distance from Easter Island to Chile
Date: Mon, 21 Apr 2014 00:39:24 +0200
User-agent: Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b34 (linux)

Emanuel Berg <address@hidden> writes:

> Frank Stutzman <address@hidden> writes:
>
>> I get an answer of 4301.199 

mee too

> That's normal

(progn 
  (defun d2r (x) (/ (* pi x) 180))
  (defun spherical-law-of-cosines (p1 p2)
    "http://en.wikipedia.org/wiki/Great-circle_distance#Formulas";
    (let ((lat1 (car p1)) (lon1 (cadr p1))
          (lat2 (car p2)) (lon2 (cadr p2)))
      (acos (+ (* (sin lat1) (sin lat2))
               (* (cos lat1) (cos lat2) (cos (- lon2 lon1)))))))
  
  (setq santiago (mapcar 'd2r '(33.4500  70.6667)))
  (setq easter_i (mapcar 'd2r '(27.1167 109.3667)))
  (insert (format "\nEaster Island to Santiago distance is%8.2f km."
                  (* (spherical-law-of-cosines santiago easter_i) 6378.1))))
                                                                            ^
put the cursor over the caret and type C-x C-e




reply via email to

[Prev in Thread] Current Thread [Next in Thread]