HP Prime variables



#5

Hello,

I have two programs and need help in programming. The first is the calculation of total hardness in water. The second is the total number of cations present in this water. As I describe below:

1st program:

EXPORT DTotal;
EXPORT Dureza_Total(Ca,Mg)
BEGIN
DTotal:=Ca*2.49+Mg*4;
END;

2st program:

EXPORT Cátions;
EXPORT TCátions(Fe3,Fe2,H,NH,Na,K,Cu,Zn,Al,Cr,Ca,Mg)
BEGIN
RETURN Dureza_Total(Ca,Mg)+Fe2*1.79+Fe3*2.69+H*50+NH*2.78+Na*2.17+K*1.28+Cu*1.57+Zn*1.53+Al*5.56+Cr*2.89▶Cátions;
END;
END;

When I run this program pops up the error: “TCátios Error: Invalid input”.
If you decrease the amount of variables, for example, from 12 to 10, the program works. This same program in 50 g works without problem. There is no solution or other alternatives?

Thank You

David


#6

Make more then one EXPORT command,

that is, break up your variables into two back to back EXPORT statements.

it seems there is an upper limit of the number of variables that one is able to place in and EXPORT (variables) statement. so I do this:

//declare variables.

EXPORT IN,OUT,NUM,EQL,TIM;
EXPORT OFA,OFB,ONA,ONB;
EXPORT TOA,TOB,CAA,CAB;
EXPORT SHA,SHB,LGA,LGB;
EXPORT WTA,WTB,WTC;

i went nuts but there was a reason. Firstly all the variables declared in a single EXPORT did not work. Since I have 5 subroutines i broke up the declaration into 5 EXPORT commands for easy editing. Each command set of variables applies to one subroutine.

cheers, geoff


try:

EXPORT TCátions()
EXPORT (Fe3,Fe2,H,NH,Na,K);
EXPORT (Cu,Zn,Al,Cr,Ca,Mg);


Edited: 30 Oct 2013, 9:11 p.m.


#7

Hello my friends:

Thanks for the help, but it didn't work. I wonder if you can't demonstrate with a concrete programme that uses and functions that have more than 12 variables? I will test it and check if it works on my machine.

Thank you in advance.

David

#8

Hello,

There is a limit to the number of parameters that a funciton can take. This limit is 16 parameters.

EXPORT and LOCAL are functions, so they have a 16 parameter limit... However, there is a subtelty there. EXPORT/LOCAL is really
EXPORT(var, value, var, value..., var, value)
this means that 1 EXPORT or LOCAL is limited to 8 variables definitions at a time.

however, USER functions can have up to 16 input parameters, so your function should be OK.

example:

EXPORT Dureza_Total(Ca,Mg)
BEGIN
return Ca*2.49+Mg*4;
END;


EXPORT TCátions(Fe3,Fe2,H,NH,Na,K,Cu,Zn,Al,Cr,Ca,Mg)
BEGIN
RETURN Dureza_Total(Ca,Mg)+Fe2*1.79+Fe3*2.69+H*50+NH*2.78+Na*2.17+K*1.28+Cu*1.57+Zn*1.53+Al*5.56+Cr*2.89;
END;

cyrille


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP: Dump the predefined variables! bluesun08 12 530 11-19-2013, 02:18 PM
Last Post: bluesun08
  HP Prime - local variables retain their initial type BruceH 4 281 11-10-2013, 12:42 PM
Last Post: Michael de Estrada
  Shutdown with the Apps key and more than 10 variables in a program. Davi Ribeiro de Oliveira 10 554 11-05-2013, 01:26 PM
Last Post: Han
  HP Prime: Number of external Variables Davi Ribeiro de Oliveira 0 127 11-01-2013, 08:10 PM
Last Post: Davi Ribeiro de Oliveira
  HP Prime - deleting variables bluesun08 1 155 10-29-2013, 06:36 PM
Last Post: Joe Horn
  HP Prime: CAS Variables - -How to save? Helge Gabert 2 219 10-27-2013, 11:26 PM
Last Post: Helge Gabert
  HP Prime Solver Variables Issue Anibal Morones Ruelas 8 480 10-19-2013, 09:45 AM
Last Post: Harold A Climer
  Prime RPN storing variables kris223 3 211 09-19-2013, 03:49 PM
Last Post: kris223
  local variables brooky 9 387 09-25-2012, 12:25 AM
Last Post: David Hayden
  Symbolic limit of a function of 2 variables, HP49/50 Gilles Carpentier 0 105 08-26-2012, 10:28 AM
Last Post: Gilles Carpentier

Forum Jump: