[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: distance from Easter Island to Chile
From: |
Emanuel Berg |
Subject: |
Re: distance from Easter Island to Chile |
Date: |
Mon, 21 Apr 2014 12:35:31 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
giacomo.boffi@gmail.com writes:
> 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))))
Can you see where the first attempt fails? That looks
like the way I perceived the formula but I get a bit
dizzy by all those mapcars - I have the subtraction in
the opposite order but that might be how we supply the
arguments. Get back to you - never ending story,
this...
--
underground experts united:
http://user.it.uu.se/~embe8573
- 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, 2014/04/21
- Message not available
- Re: distance from Easter Island to Chile,
Emanuel Berg <=
- 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