From the user, an air temperature , a dewpoint temperature , and a station pressure are given.
The calculation of the mixing ratio is quite involved. In order to calculate the mixing ratio, a saturated vapor pressure must be computed for values of air temperature, and an actual vapor pressure must be computed for values of dewpoint temperature. But before the vapor pressures can be computed, the air temperature and/or dewpoint temperature must be converted to degrees Celsius . To see how to convert temperatures, see the link below:
http://www.srh.noaa.gov/elp/wxcalc/formulas/tempConvert.html
Then, using the values of air temperature and/or dewpoint temperature the vapor pressure(s) can be computed. To see how to calculate the vapor pressure(s), see the link below:
http://www.srh.noaa.gov/elp/wxcalc/formulas/vaporPressure.html
Next, the station pressure must be converted to millibars or hectoPascal
To see how to convert the station pressure, see the link below:
http://www.srh.noaa.gov/elp/wxcalc/formulas/pressureConversion.html
Finally, the actual mixing ratio and/or saturated mixing ratio can be calculated using the formula below
For a bonus answer, the relative humidity can be calculated using the answers from the actual mixing ratio and the
saturated mixing ratio by using the formula below: