Horizontal sundial calculations: Difference between revisions

J: rephrase to highlight use of atan2
(J: avoid principal value issue)
(J: rephrase to highlight use of atan2)
Line 482:
 
<lang j>require 'trig'
atan2=: {:@*.@j. NB. arc tangent of y divided by x
 
horiz=: verb define
'lat lng ref'=. y
Line 492 ⟶ 493:
'Diff longitude ' out -diff=. ref - lng
lbl=.'hour ';'sun hour angle ';'dial hour line angle'
r=.((,. (,. ({:@*.@j.atan2 *&slat)/@+.@r.&.rfd)) diff + 15&*) i:6
smoutput lbl ,: ('3.0';'7.3';'7.3') 8!:1 r
)</lang>
6,962

edits