Hi,
Just started the look at some more complete Mathematica programming and got stuck with implementing functions.
Could anyone show me how to execute few computation in a single function?
PTpcM[GasSGHC_,Co2Mol_,H2sMol_,N2Mol_,TpcmCorr_,PpcmCorr_,Oil_:True]:=
(*If checking if Oil optional is True then does PpcHC computation for True and then False*)
If[Oil=True, PpcHC=677+15*GasSGHC-37.5*GasSGHC^2; TpcHC=168+325*GasSGHC-12.5*GasSGHC^2, (*Both PpcHC and TpcHC should be computed here if Oil= True*)
PpcHC=706+51.7*GasSGHC-11.1*GasSGHC^2;
TpcHC=187+330*GasSGHC-71.5*GasSGHC^2;] (*Computed if Oil=False*)
(*Below part needs to be computed in the function*)
TpcM=(1-Co2Mol-H2sMol-N2Mol)*TpcHC+227.3*N2Mol+547.6*Co2 + 672.4*H2s;
PpcM= (1-Co2Mol-H2sMol-N2Mol)*PpcHC+493*N2Mol+1071*Co2+1306*H2s;
e = 120 * ((Co2Mol+ H2sMol) ^ 0.9 - (Co2Mol+ H2sMol) ^ 1.6) + 15 * (H2sMol^ 0.5 - H2sMol ^ 4);
TpcmCorr = TpcM - e;
PpcmCorr = PpcM * (TpcM - e) / (TpcM + H2s * (1 - H2s) * e);
(*Function stops here*)
Isn’t this possible, what am I doing wrong? So far, I didn’t find any example showing Application/programs with long functions, but rather short one, why is that?
Thank you for the help and direction.
Regards
Hugh