sorry for my layman terminology, but to my understanding as a coder a function has a name, parameters, arguments and operations. if sin is the name, and its parameters are side opposite and hypotenuse, and its arguments are context dependent, what is the operation itself? am i making sense?

def sin (hypotenuse, opposite):
     ??!?!?!!?
  • criitz@reddthat.com
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    11 months ago

    One way to think about it -

    The argument to the function is an angle

    The operation is:

    Draw a triangle with hypotenuse length 1, one angle 90, another angle is the one passed to the function

    Divide the length of the side opposite the passed angle by the length of the hypotenuse

    Return this value

    The other trig functions are the same with different sides being divided.