Function Exercises

| categories: Practice

Today in lab I'll answer questions and then you'll work with functions. These are best done in a script. There is nothing to turn in and no grade will be assigned. Of course you may ask any questions.

  1. Write a function FtoC(t) that converts temperature in Fahrenheit to Celsius.
  2. Write a function CtoF(t) that goes back from Celsius to Fahrenheit.
  3. Write a function to compute the Dew Point given the temperature in Celsius and the relative humidity. I suggest you start with the simple approximation and only then try the Magnus formula if you're feeling extra bold.
  4. Now, using the functions you've written above, write one more function to compute the Dew Point in Fahrenheit given the temperature in F and the relative humidity.