local variable depending on another
10-09-2017, 06:00 PM
Post: #1
 Ziz Junior Member Posts: 8 Joined: May 2016
local variable depending on another
Hello,

How i can program a local variable that depend of another local variable and then discovery the value of on variable like function of another?
Basically this is my code:
///////////////////////////////////////////////////////////////////////////////////
LOCAL coef_A3,pol_3,pv_sat3,pp_vap2,Trosee;
LOCAL expressao2, conv_temp, pp_vap1;
conv_temp:=273;
pp_vap1:=101;

coef_A3=1-(Trosee+conv_temp)/647.096);

pol_3=-7.85951783*coef_A3+1.84408259*(coef_A3^1.5)-11.7866497*(coef_A3^3)+22.6807411*(coef_A3^3.5)-15.9618719*(coef_A3^4)+1.80122502*(coef_A3^7.5);

pv_sat2=(647.096/(Trosee+conv_temp))*pol_3)*22.064*10^6;

pp_vap2:=pp_vap1;

expr2=pv_sat2-pp_vap2;

CAS(solve(expr2=0,Trosee));
PRINT ("T de rosée2="+Trosee+"ºC");
///////////////////////////////////////////////////////////////////
Where coef_A3, pol_3, pv_sat2 are functions of Trosee that is unknown.

Thanks!
10-10-2017, 12:46 AM
Post: #2
 webmasterpdx Senior Member Posts: 541 Joined: Sep 2015
RE: local variable depending on another
If what you are asking is how to resolve a dependency of one variable on another, I'd suggest you replace the second variable with a function call, where it derives the value from the first variable. Would that work?
-Donald
10-10-2017, 07:31 AM
Post: #3
 cyrille de brébisson Senior Member Posts: 1,047 Joined: Dec 2013
RE: local variable depending on another
Hello,

if coef_A3 and the like are functions, why are you not declaring them as functions (implementing them in your program?)

If what you are trying to do si more on the formal calculation side of things, you might want to create a CAS program, which is able to handled undefined functions/variables rather than a Home program.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)