Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1 @@
avgAngleD=: 360|(_1 { [: (**|)&.+.@(+/ % #)&.(*.inv) 1,.])&.(1r180p1&*)

View file

@ -0,0 +1,6 @@
rfd=: 1r180p1&* NB. convert angle to radians from degrees
toComplex=: *.inv NB. maps integer pairs as length, complex angle (in radians)
mean=: +/ % # NB. calculate arithmetic mean
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 NB. calculate average angle in degrees

View file

@ -0,0 +1,10 @@
avgAngleD 10 350
0
avgAngleD 90 180 270 360 NB. result not meaningful
0
avgAngleD 10 20 30
20
avgAngleD 20 350
5
avgAngleD 10 340
355