Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,17 @@
import math, complex
proc rect(r, phi): Complex = (r * cos(phi), sin(phi))
proc phase(c): float = arctan2(c.im, c.re)
proc radians(x): float = (x * Pi) / 180.0
proc degrees(x): float = (x * 180.0) / Pi
proc meanAngle(deg): float =
var c: Complex
for d in deg:
c += rect(1.0, radians(d))
degrees(phase(c / float(deg.len)))
echo "The 1st mean angle is: ", meanAngle([350.0, 10.0]), " degrees"
echo "The 2nd mean angle is: ", meanAngle([90.0, 180.0, 270.0, 360.0]), " degrees"
echo "The 3rd mean angle is: ", meanAngle([10.0, 20.0, 30.0]), " degrees"