The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP Prime: RANDOM
Message #1 Posted by Alberto Candel on 16 Oct 2013, 12:33 p.m.

Good Morning,

From Home, Toolbox- Math- Probability - Random - Number sets up the RANDOM function which inputs two numbers and outputs a random number in between those two. Produces a display like

RANDOM(1,100) 99.2856397571

In CAS, the same sequence of key presses produces the display

RANDOM(1+100*i) 20.2759023826

I wonder what is the role of the "i" in RANDOM. That is, I did not input "i" to RANDOM, I typed RANDOM(1,100) but it displayed the line above.

Thanks!

      
Re: HP Prime: RANDOM
Message #2 Posted by parisse on 16 Oct 2013, 12:39 p.m.,
in response to message #1 by Alberto Candel

RANDOM does not follow the same grammatical rule as "normal" functions for the CAS parser. You must write it without parenthesis RANDOM 1,100 or with parenthesis *outside* (RANDOM 1,100)

            
Re: HP Prime: RANDOM
Message #3 Posted by Alberto Candel on 16 Oct 2013, 12:44 p.m.,
in response to message #2 by parisse

I see, thank you. But then, I wonder why the parenthesis come in when choosing RANDOM. that it's, the sequence of key presses above sets up RANDOM().

      
Re: HP Prime: RANDOM
Message #4 Posted by Han on 16 Oct 2013, 2:14 p.m.,
in response to message #1 by Alberto Candel

Quote:
Good Morning,

From Home, Toolbox- Math- Probability - Random - Number sets up the RANDOM function which inputs two numbers and outputs a random number in between those two. Produces a display like

RANDOM(1,100) 99.2856397571

In CAS, the same sequence of key presses produces the display

RANDOM(1+100*i) 20.2759023826

I wonder what is the role of the "i" in RANDOM. That is, I did not input "i" to RANDOM, I typed RANDOM(1,100) but it displayed the line above.

Thanks!


(a,b) is interpreted by the CAS parser to mean complex numbers. Ideally, though, RANDOM should have actually parsed RANDOM(1,100) "properly" and only assume a complex input when typing RANDOM((1,100)) -- we can only hope that they can find a way to do this for the next firmware.

            
Re: HP Prime: RANDOM
Message #5 Posted by Alberto Candel on 18 Oct 2013, 9:18 p.m.,
in response to message #4 by Han

I hope HP hears you. One unfortunate issue that this mismatch of notation causes is that "importing" is useless. It still works from Home to CAS, but it creates a messy instruction from CAS to Home.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall