Created
May 29, 2021 12:12
-
-
Save etoyoda/29f2ec36bf9902301c4cd57535a7d76a to your computer and use it in GitHub Desktop.
inverse function of Tetens formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tetens t | |
6.112 * Math.exp(17.67 * (t - 273.15) / (t - 29.65)) | |
end | |
def invtetens e | |
k = Math.log(e/6.112) / 17.67 | |
0.05 * (-5463.0 + 593.0 * k) / (-1.0 + k) | |
end | |
(0..50).each {|tc| | |
t = tc + 273.15 | |
e = tetens(t) | |
rt = invtetens(e) | |
rtc = rt - 273.15 | |
printf "%10.2f %10.2f %10.2f\n", tc, e, rtc | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment