Re: HP Prime: Number of external Variables (355 Views)
Reply
Occasional Advisor
Davidro
Posts: 17
Registered: ‎10-05-2013
Message 1 of 4 (418 Views)

HP Prime: Number of external Variables

Friends,

 

I need your help. How to make the program very simple below work:

 

EXPORT TVariables (A, B, C, D, E, F, G, H, I, J, K, L, M, N)

BEGIN

RETURN A + B + C + D + E + F + G + H + I + J + K + L + M + N;

END;

In the edition of the program does not give error, the message is: !No erros in the program. When I go to run it, it pops up the error message: XTVariables: Invalid imput . If I remove 4 variables, the program works. Have as you send me the correct syntax for this program works and I take for base for others?

Thanks

David

Honored Contributor
Miguel Angel Caporalini
Posts: 2,392
Registered: ‎02-09-2009
Message 2 of 4 (390 Views)

Re: HP Prime: Number of external Variables

[ Edited ]

Hi!, Davidro:

 

Welcome, to Forum!.

 

You didn't use, reserved variables ... e, i, j, n (they are, for other application) ... p.e.: i, j ... imaginary or, complex.

In your example, you can use CAPITAL LETTERS or, lowercase letters.

VARIABLES_1.JPG VARIABLES_2.JPG VARIABLES_3.JPG

 

Too, you can use numeric indicator's with letter's ... e1, i1, j1, n1  ...

VARIABLES_4.JPG VARIABLES_5.JPG VARIABLES_6.JPG

 

Note: See, in the User's Guide Manual, attached, in file.

Trusted Contributor
Joseph Horn
Posts: 96
Registered: ‎09-25-2006
Message 3 of 4 (355 Views)

Re: HP Prime: Number of external Variables

Hi, David!

 

The problem is not with your program, but with how you are running it.

 

The "Run" button in the Program Catalog handles a maximum of 10 parameters. If the program has more than 10 parameters, "Run" only inputs the first 10, attempts to run the program with just those 10, and of course Prime generates an error since there are too few parameters.

 

The trick is to run your program from Home (or CAS).  This allows you to have any number of parameters.  In your example, you can type this in Home (or CAS):

 

TVariables(1,2,3,4,5,6,7,8,9,10,11,12,13,14)

 

... and it will return the correct result (105).  Even though built-in functions are limited to a maximum of 16 arguments, programs don't seem to have that limitation.  I just extended your program to the first 17 letters of the alphabet (up to Q), and ran it with parameters 1 through 17, and it returned the correct sum, 153.

 

Hope that helps!

-Joe-
Occasional Advisor
Davidro
Posts: 17
Registered: ‎10-05-2013
Message 4 of 4 (349 Views)

Re: HP Prime: Number of external Variables

Dear Michael:

 

Thank you for your prompt response, as in other groups have not yet been answered. The big problem is that the system does not export above 10 variables, as in the simple example given: are 14 variables, ranging  from A to N. withdraw  4 any variables the program works. 

My question is: the HP Prime Program Editor  only exports 10 variables? There is another way of working with many external variables in the same program?

 

Thank you in advance.

 

David

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.