Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Averages-Mean-angle/Factor/averages-mean-angle.factor
Normal file
11
Task/Averages-Mean-angle/Factor/averages-mean-angle.factor
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
USING: formatting kernel math math.functions math.libm math.trig
|
||||
sequences ;
|
||||
|
||||
: mean-angle ( seq -- x )
|
||||
[ deg>rad ] map [ [ sin ] map-sum ] [ [ cos ] map-sum ]
|
||||
[ length ] tri recip [ * ] curry bi@ fatan2 rad>deg ;
|
||||
|
||||
: show ( seq -- )
|
||||
dup mean-angle "The mean angle of %u is: %f°\n" printf ;
|
||||
|
||||
{ { 350 10 } { 90 180 270 360 } { 10 20 30 } } [ show ] each
|
||||
Loading…
Add table
Add a link
Reference in a new issue