Averages/Mean angle: Difference between revisions
m
J: make the second defn consistent with the first
m (J: Added a couple examples, and changed the result (was between _180 and 180, now between 0 and 360)) |
m (J: make the second defn consistent with the first) |
||
Line 528:
roundComplex=: (* * |)&.+. NB. discard an extraneous least significant bit of precision from a complex value whose magnitude is in the vicinity of 1
avgAngleR=: _1 { [: roundComplex@mean&.toComplex 1 ,. ] NB. calculate average angle in radians
avgAngleD=: 360|avgAngleR&.rfd</lang>
Example use:
<lang J> avgAngleD 10 350
|