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,15 @@
import Data.Complex (cis, phase)
meanAngle
:: RealFloat c
=> [c] -> c
meanAngle = (/ pi) . (* 180) . phase . sum . map (cis . (/ 180) . (* pi))
main :: IO ()
main =
mapM_
(\angles ->
putStrLn $
"The mean angle of " ++
show angles ++ " is: " ++ show (meanAngle angles) ++ " degrees")
[[350, 10], [90, 180, 270, 360], [10, 20, 30]]

View file

@ -0,0 +1,17 @@
-- file: trigdeg.fs
deg2rad deg = deg*pi/180.0
rad2deg rad = rad*180.0/pi
sind = sin . deg2rad
cosd = cos . deg2rad
tand = tan . deg2rad
atand = rad2deg . atan
atan2d y x = rad2deg (atan2 y x )
avg_angle angles = atan2d y x
where
y = mean (map sind angles)
x = mean (map cosd angles)
-- End of trigdeg.fs --------