Averages/Mean angle: Difference between revisions
m
→{{header|J}}
m (→{{header|J}}) |
|||
Line 522:
=={{header|J}}==
<lang J>avgAngleD=: 360|(_1 { [: (**|)&.+.@(+/ % #)&.(*.inv) 1,.])&.(1r180p1&*)</lang>
This verb can be represented as simpler component verbs, for example:
<lang J>rfd=: 1r180p1&* NB. convert angle to radians from degrees
toComplex=: *.inv NB. maps integer pairs as length, complex angle (in radians)
|