[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 11:45:29 +0200 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) XEmacs/21.5-b34 (linux) |
Emanuel Berg <embe8573@student.uu.se> writes:
> giacomo.boffi@gmail.com writes:
>
>>> I get an answer of 4301.199
>>
>> me too
>
> Provided the implementation is correct that's what you get with the
> Haversine method.
(defun d2r (x)
"degrees-to-radians is a macro, won't work with mapcar..."
(/ (* x pi) 180))
; wolfram's alpha says
(setq average-earth-radius 6367.4447)
; there are sources that report different locations
; for Santiago and Easter Island
(setq santiago (mapcar 'd2r '(33.4500 70.6667)))
(setq easter_i (mapcar 'd2r '(27.1167 109.3667)))
(defun haversines (p1 p2)
"Returns a list with sin^2(Delta_Lat/2) and sin^2(Delta_Lon/2).
http://en.wikipedia.org/wiki/Haversine"
(flet ((d2 (x) (/ x 2))
(p2 (x) (* x x)))
(mapcar 'p2 (mapcar 'sin (mapcar 'd2 (mapcar* '- p1 p2))))))
(defun central-angle (p1 p2)
"Returns the central angle between two locations on a sphere,
using the haversine formula.
http://en.wikipedia.org/wiki/Great-circle_distance#Computational_formulas "
(let* ( (hs (haversines p1 p2))
(hs-lat (car hs))
(hs-lon (cadr hs))
(cos-lat1 (cos (car p1)))
(cos-lat2 (cos (car p2)))
)
(* 2 (asin (sqrt (+ hs-lat (* cos-lat1 cos-lat2 hs-lon)))))))
(insert (format "\n%f" (* 6378.1
(central-angle santiago easter_i))))
(insert (format "\n%f" (* average-earth-radius
(central-angle santiago easter_i))))
- distance from Easter Island to Chile, Emanuel Berg, 2014/04/19
- Re: distance from Easter Island to Chile, Frank Stutzman, 2014/04/20
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/20
- Re: distance from Easter Island to Chile, giacomo . boffi, 2014/04/20
- Message not available
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/20
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/20
- Re: distance from Easter Island to Chile,
giacomo . boffi <=
- Message not available
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/21
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/21
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/22
- Message not available
- Re: distance from Easter Island to Chile, Emanuel Berg, 2014/04/20
Re: distance from Easter Island to Chile, Barry Margolin, 2014/04/20
Re: distance from Easter Island to Chile, Eli Zaretskii, 2014/04/20
Message not available