"""python module pycal
it can be used to calculate things with difficult-to-remember formulas
for example, celsius to fahrenheit or pythagoram's theorum or the area of a circle.
made by Larry Zhang
free of distribution, all rights reserved.
version history:
1.0 8/25/18
finished writing the first copy - introducing functions c_to_f, circlearea, trianglearea and f_to_c.
1.1 9/25/18
added ptheory, weight and density
"""
# converts celsius to fahrenheit
def c_to_f(celsius):
    return (celsius * 9.0 / 5 + 32)

# calculates the area of a circle
def circlearea(radius):
    return (radius**2*3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679)

# calculates the area of a triangle
def trianglearea(base, height):
    return (base*height/2)

# converts fahrenheit to celsius
def f_to_c(F):
    return(5.0 / 9.0 * (F - 32))

# pythagoras' theorem
def ptheory(a, b):
    return(a**2+b**2)

# calculates the weight (gravitational pull) on an object
def weight(m, g):
    return(m*g)

# calculates the density of an object
def density(m, v):
    return (m/v)




