Math Question?
I need to form equation :
Double vpsat = e(A/T + B + CT + DT2 + ET3 + F lnT)
where:
A = -1.044x10 (to the 4th)
B = ?.129 465 0 x 10 (to the 1st)
C = ?.702 235 5 x 10?
D = ?.289 036 0 x 10?
E = ?.478 068 1 x 10?
F = ?.545 967 3
T ?Temperature of the air in 癛,
癛 = 癋 + 459.67
Questions are how do I form a number such as variable A?
What does the e represent in the equation? I'm not a big math guy and I can't for the life of me figure out what the e represents. I'm trying to calculate Vapor Pressure Deficit (VPD) from Temperature and Humidity based on the equations laid out on the 2nd to last page of this :
http://ohioline.osu.edu/aex-fact/0804.html
A shove in the right direction will be greatly appreciated.
[808 byte] By [
xavier33a] at [2007-11-27 9:59:37]

> I need to form equation :
>
> Double vpsat = e(A/T + B + CT + DT2 + ET3 + F lnT)
>
> where:
> A = -1.044x10 (to the 4th)
> B = ?.129 465 0 x 10 (to the 1st)
> C = ?.702 235 5 x 10?
> D = ?.289 036 0 x 10?
> E = ?.478 068 1 x 10?
> F = ?.545 967 3
> T ?Temperature of the air in 癛,
> 癛 = 癋 + 459.67
>
> Questions are how do I form a number such as variable
> A?
use a float data type to store the value, also look at the math library !
> What does the e represent in the equation? I'm not a
> big math guy and I can't for the life of me figure
> out what the e represents.
e is a math constant, like pi. its value is 2.71828
I'm trying to calculate
> Vapor Pressure Deficit (VPD) from Temperature and
> Humidity based on the equations laid out on the 2nd
> to last page of this :
>
> http://ohioline.osu.edu/aex-fact/0804.html
>
> A shove in the right direction will be greatly
> appreciated.
Any chance someone can walk me through this one? I'm hoping to get a method that will accept the temperature, canopy temperature, and Relative Humidity (%rh) and calculate then return vapor pressure deficit (VPD) based on the calculation on the page posted above.
> Questions are how do I form a number such as variable A?double a = -1.044 * Math.pow(10, 4);
As was noted before e is just a number (2.71828). In your equation to take e to the power of the thing in parentheses.double vpstat = Math.exp(sum);
And for ln - natural logarithm - use Math.log().
(I'd never heard of 癛 before - had to look it up. 癛a==Rankine, not to be confused with 癛?=R閍umur)
[Edit] I've just seen the previous which you posted while I was figuring out why your constants were different from those on Wikipedia (who use 癒!). Post what you've got if you're stuck.
Thank you sooo much you've given me a place to start!! thanks man!
This may be a good start. a is raised the 4th power.double a = -1.044*10;double A = Math.pow( a, 4);
> This may be a good start. a is raised the 4th power.>> double a = -1.044*10;> double A = Math.pow( a, 4);Except that it's not supposed to be (-1.044*10)^4, but -1.044*10^4. See my previous post.
What do I do with the ln ? inF lnT from a google search I see it a natural logarith but what does this mean? and how do I apply it to the equation I so far have:
public static double getVPD(double temperature, double canopyTemp, double relativeHumidity){
double a = -1.044 * Math.pow(10, 4);
double b = -1.129 * Math.pow(10, 1);
double c = -2.702 * Math.pow(10, -2);
double d = 1.289 * Math.pow(10, -5);
double e = -2.478 * Math.pow(10, -9);
double f = 6.456;
double T = 0;
T = Conversions.CToF(temperature) + 459.67;
double sum = ( a/T + b + c*T + Math.pow(d*T,2) + Math.pow(e*T,3) + (f * (Math.log(T) )) );
double vpsat = Math.exp(sum);
double vpair = vpsat x relativeHumidty ?100;
double vpd = vpsat - vpair;
return vpd;
}
Does this process the equation correctly?
> What do I do with the ln ? inF lnT from a
> google search I see it a natural logarith but what
> does this mean? and how do I apply it to the equation
> I so far have:
ln(x) is the inverse of e^x.
ln(x) can be calculated by Math.log(x).
I assume temperature is in 癈, and that Conversions.CToF() does a 癈->癋 conversion. It looks OK providing you make a couple of changes to the d and e terms.double sum = ( a/T + b + c*T + d * Math.pow(T,2) + e * Math.pow(T,3) + (f * (Math.log(T) )) );
You can test it by calculating a few values and comparing them to what you get from the charts on the page you linked to.
I'm doing something wrong somewhere. All are being returned as 0.0...so I figure I must be multiplying by zero somewhere but where?
double vpair = vpsat * relativeHumidty / 100;of course.What values are you using to test it with?
with :
public static double getVPD(double temperature, double canopyTemp, double relativeHumidity){
double a = -1.044 * Math.pow(10, 4);
double b = -1.129 * Math.pow(10, 1);
double c = -2.702 * Math.pow(10, -2);
double d = 1.289 * Math.pow(10, -5);
double e = -2.478 * Math.pow(10, -9);
double f = 6.456;
double T = 0;
T = Conversions.CToF(temperature) + 459.67;
double sum = ( a/T + b + c*T + d * Math.pow(T,2) + e * Math.pow(T,3) + (f * (Math.log(T) )) );
double vpsat = Math.exp(sum);
double vpair = vpsat x relativeHumidty / 100;
double vpd = vpsat - vpair;
return vpd;
}
With the above I plugged in 38.7 relativeHumidity and 26 C (79F) and I'm receiving -.17322 which definitely isn't what the chart says it should be.
You get a negative number? That's weird. Here's what I see (note: you still have x for * where you calculate vpair)public class Vpd {
public static void main(String args[]) {
// example A
double temp = (50.0 - 32) * 5 / 9;
double rh = 80;
System.out.println(getVPD(temp, temp, rh)); //0.0205psi
// example B
temp = (70.0 - 32) * 5 / 9;
rh = 80;
System.out.println(getVPD(temp, temp, rh)); //0.0416psi
// your example
rh = 38.7;
temp = 26;
System.out.println(getVPD(temp, temp, rh)); //0.1709psi
}
public static double getVPD(double temperature, double canopyTemp,
double relativeHumidity) {
double a = -1.044 * Math.pow(10, 4);
double b = -1.129 * Math.pow(10, 1);
double c = -2.702 * Math.pow(10, -2);
double d = 1.289 * Math.pow(10, -5);
double e = -2.478 * Math.pow(10, -9);
double f = 6.456;
double t = 0;
t = Conversions.CToF(temperature) + 459.67;
System.out.println("t=" + t);
double sum = a/t + b + c*t + d*Math.pow(t,2) + e*Math.pow(t,3) + f*(Math.log(t));
double vpsat = Math.exp(sum);
System.out.println("vpsat=" + vpsat);
double vpair = vpsat * relativeHumidity / 100;
System.out.println("vpair=" + vpair);
double vpd = vpsat - vpair;
return vpd;
}
}
class Conversions {
static double CToF(double celsius) {
return celsius * 9 / 5 + 32;
}
}
SWEET! Got it figured out. The value wasn't negative my dumb a$$ had : System.out.println("VPD is -" + vpd); so it wasn't negative at all...THANK YOU SO MUCH TO ALL!
Glad you've got it figured out.I guess you realise that you're not using the canopy temperature for anything. From what I gather you use the canopy temperature if possible, otherwise the air temperature.