Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Matthew Larson Exercise 1.4 10/4/2019
- -- Hypotenuse.hs
- -- | A module for working with triangles.
- module Hypotenuse where
- -- | Compute the length of the hypotenuse of a triangle from the lengths
- -- of its sides.
- hypotenuse :: Double -> Double -> Double
- hypotenuse a b = sqrt (a^2 + b^2)
- -- | Square a number.
- square :: Num n => n -> n
- square x = x ^ 2
- law_of_cosines :: Double -> Double -> Double -> Double
- law_of_cosines a b gamma = sqrt (a^2 + b^2 - 2*a*b*cos(gamma*pi/180))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement