Question
Intern
Posts: 43
Member Since: ‎09-29-2012
Message 1 of 4 (1,289 Views)

# Frustrated with Odd behavior of DEFINE command in HP PRIME!

I have been trying to define a function using The DEFINE command. The function is F=G*M*m / r^2. No matter what I try, I always get the same generic error: INVALID ENTRY. I went to the user manual, guess what, half a page of information regarding the DEFINE command. Better than nothing, but a lot short of what you expect if the manual is YOUR primary source of information for learning to use the calculator. By Trial an error here is what I discovered:

(1) Function name can't be 1 letter long. They can combine Uppercase, lowercase and numbers...
(2) Variables must be UPPERCASE
(3) Variables can begin with a letter and be followed by a single number. ONLY THAT, nothing more

It is pretty limiting. So now, instead of the calculator working for me I must work for her. This is the formula I have: F=G*M*m / r^2  and this is what the calculator would accept in the DEFINE screen: F12=G*M1*M2/R^2, see figure 1. Pretty annoying, but I can leave with it.

As you know, G, is the gravitational constant: 6.67384 x 10^-11.  The calculator is suppose to have it in memory, so, why type it again?  I went to the CAS view, called my function, put some dummy numbers, just to try it, got G from SHIFT > Units > Const > Physics.  This is how my edition line looks like: F12(6.67384E-11,100,300,25).. see figure 2. Guess what? GENERIC ERROR, no clue what the calculator don't like about it. After a while, I discovered it doesn't like the E in 6.67384E-11, it prefers it like  6.67384e-11, then it throws another error (Bad argument count) see figure 3. I check everything, it seems all right.

I decide to try my LUCK in the main screen. Everything works perfect. it doesn't even complain about the"E" in G, and I get the result expected (figure 4).

I went back to the define screen and changed the name of the function from F12 to Forc, put the numbers again, MAGIC, now it works  (see figure 5).  So, after all, it seems to be the calculator doesn't like the numbers in the name of the function, but it didn't complain. Come on guys, you don't buy a top of the line calculator to go through this torment.

Can someone tell me what's the reason for the odd behavior?

# Re: Frustrated with Odd behavior of DEFINE command in HP PRIME!

Hello,

DEFINE functions MUST follow the rules of the Home screen in every way shape and form. For example, variables must be valid system variables...

DEFINE functions names can not collide with existing variables/function names, which is why you can not use single uppercase laters for naming them...

If you want to use variable names other than the pre-defines ones, you will need to create them first. Althrough you could create them in CAS, it is better to create them in Home as, as a general rule, it is better NOT to mix CAS and Home stuff (it is much slower and is more likely to lead to troubles). To create a new user variable in home, just affect a value to a variable as in abc:=5 (or 5->abc where -> is the sto arrow)... You will be asked if you want to create the variable. answer yes and here you are...

Cyrille

View solution in context
Intern
Posts: 43
Member Since: ‎09-29-2012
Message 2 of 4 (1,203 Views)

# Re: Frustrated with Odd behavior of DEFINE command in HP PRIME!

Solved! Here is how you can deal with this situation:

F = G Mm / r^2

1) Name, to begin with an uppercase it must be at least two letters long, no way around it. I called it Fg

2) G, M ... No problem with them, you can use built-in variables

3) m, r ... define the variables in the CAS first, and initialize them to 0.  eg  r:=0.  ,  m:=0.

4) you must include the point after the Zero so the variables are initialized as real and not as integer

5) In the DEFINE window, enter the function and unmarked G, since it is a constant

6) Initiate G in the CAS.  G:=6.67 X 10^-11

7) You can now use your defined function, calling it with the parameters M, m, r... eg  Fg(400, 50,30)  --> result 1.48E-9

Intern
Posts: 37
Member Since: ‎05-30-2013
Message 3 of 4 (1,177 Views)

# Re: Frustrated with Odd behavior of DEFINE command in HP PRIME!

Hello,

DEFINE functions MUST follow the rules of the Home screen in every way shape and form. For example, variables must be valid system variables...

DEFINE functions names can not collide with existing variables/function names, which is why you can not use single uppercase laters for naming them...

If you want to use variable names other than the pre-defines ones, you will need to create them first. Althrough you could create them in CAS, it is better to create them in Home as, as a general rule, it is better NOT to mix CAS and Home stuff (it is much slower and is more likely to lead to troubles). To create a new user variable in home, just affect a value to a variable as in abc:=5 (or 5->abc where -> is the sto arrow)... You will be asked if you want to create the variable. answer yes and here you are...

Cyrille

Highlighted
Intern
Posts: 43
Member Since: ‎09-29-2012
Message 4 of 4 (1,073 Views)

# Re: Frustrated with Odd behavior of DEFINE command in HP PRIME!

Thanks!
† 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