Page 21-25
Input string program for two input values
The input string program for two input values, say a and b, looks as follows:
«
“
Enter a and b:
“
{
“
:a:
:b:
“
{2 0} V } INPUT OBJ
→
»
This program can be easily created by modifying the contents of INPTa. Store
this program into variable INPT2.
Application
: evaluating a function of two variables
Consider the ideal gas law, pV = nRT, where p = gas pressure (Pa), V = gas
volume(m
3
), n = number of moles (gmol), R = universal gas constant =
8.31451_J/(gmol*K), and T = absolute temperature (K).
We can define the pressure p as a function of two variables, V and T, as p(V,T)
= nRT/V for a given mass of gas since n will also remain constant. Assume
that n = 0.2 gmol, then the function to program is
We can define the function by typing the following program
«
→
V T
‘
(1.662902_J/K)*(T/V)
’
»
and storing it into variable
@@@p@@@
.
The next step is to add the input string that will prompt the user for the values of
V and T. To create this input stream, modify the program in
@@@p@@@
to read:
«
“
Enter V and T:
“
{
“
:V:
:T:
“
{2 0} V }
INPUT OBJ
→ →
V T
‘
(1.662902_J/K)*(T/V)
’
»
Store the new program back into variable
@@@p@@@
. Press
@@@p@@@
to run the program.
Enter values of V = 0.01_m^3 and T = 300_K in the input string, then press
V
T
K
J
V
T
T
V
p
⋅
=
⋅
⋅
=
)
_
662902
.
1
(
2
.
0
31451
.
8
)
,
(
Summary of Contents for 50G
Page 1: ...HP g graphing calculator user s guide H Edition 1 HP part number F2229AA 90006 ...
Page 130: ...Page 2 70 The CMDS CoMmanDS menu activated within the Equation Writer i e O L CMDS ...
Page 206: ...Page 5 29 LIN LNCOLLECT POWEREXPAND SIMPLIFY ...
Page 257: ...Page 7 20 ...
Page 383: ...Page 11 56 Function KER Function MKISOM ...
Page 715: ...Page 21 68 Whereas using RPL there is no problem when loading this program in algebraic mode ...
Page 858: ...Page L 5 ...