cancel
Showing results for 
Search instead for 
Did you mean: 
ahjc
Level 1
12 7 0 0
Message 1 of 4
1,530
Flag Post

Input command in CAS programs HP Prime

HP Recommended
HP Prime

My HP Prime is under 12066 firmware version (2017-07-10).

 

I am trying to run the following program (in CAS mode):

 

#cas

IN():=

Begin

   LOCAL u;

   INPUT({{u,[4]}});

  RETURN u;

END;

#end

 

As answer, I only get: "Error: Invalid input".

What is wrong in this program?

 

Thank you for the answer.

 

 

 

0 Kudos
Tags (1)
3 REPLIES 3
Jan_D
Level 6
305 297 32 76
Message 2 of 4
Flag Post
HP Recommended

INPUT is not a CAS command and you can not use it inside a CAS program.

 

Personally I do not like to work with the INPUT command when dealing with CAS problems. 

 

It is possible though.

 

In one source program you can define 2 programs, a CAS program which begins with #cas and ends with #end, and a non-CAS program.

 

Within the CAS program you can call the non-CAS program which contains the INPUT command, and which must be exported.

 

You thus get the variable for further use in the CAS program.

 

Of course the variable can not be a local variable in the non-CAS program in this case.

Because you intend to work with matrices it is maybe simplest to use a global variable like M1, or maybe you can define a local variable m at the  beginning of the source program, which can be used by both programs.

 

I do not remember well if this works properly.

ahjc
Author
Level 1
12 7 0 0
Message 3 of 4
Flag Post
HP Recommended

Thank you for your answer.

About the INPUT command, it should have been interesting to write, in the help : not to be used in CAS programs.

0 Kudos
kain_x_x
Level 1
7 3 1 1
Message 4 of 4
Flag Post
HP Recommended

Also it's a problem that you don't get any errors when check the program but simply when you tries to launch it you get that (!) symbol.

 

0 Kudos
† 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