02-01-2020, 06:43 PM
I am trying to write a program on my HP Prime to solve for Z but when I use the solve function it is only returning 0. When I do the same equation on the CAS it works but not in my actual program. This is my code:
I cant seem to figure out how to get the solver function to work inside my program. If anyone knows how to fix this problem I would greatly appreciate the help.
Code:
export Tc, Pc, Tr, Pr;
export β,α,фi,fi;
export s,Є,Ω,ѱ;
EXPORT Fugacity()
BEGIN
local Zv,Zl,Iv,Il;
local w,c,q;
Ω:=.0778;
Є:=1-√2;
s:=1+√2;
ѱ:=.45724;
input({T,Tc,P,Pc});
input({w});
Tr:=T/Tc;
Pr:=P/Pc;
c:=1+(0.37464+1.54226*w-0.26992*w^(2));
α:=(c*(1-Tr^(1/2)))^2;
β:=(Ω*(Pr/Tr));
q:=ѱ*α/Tr/Ω;
//Z for vapor
solve(0:=1+β-q*β*((Z-β)/(Z+β*Є)/(Z+s*β)),Z,1);
msgbox(Z); //testing to see if this solves for Z
Zv:=Z;
I cant seem to figure out how to get the solver function to work inside my program. If anyone knows how to fix this problem I would greatly appreciate the help.