Post Reply 
units of variables?
02-27-2018, 11:58 AM
Post: #1
units of variables?
I could had chance to put units on variables in my HP 50G , but couldn't do it at my hp prime yet and could find any document how to do... .
What I want to do: I am making my own application. Example on a simple equation P= F/A
F variable must be kg and A variable must be cm2 and the result P will be bar or kg/cm2
thanks in advance...
Find all posts by this user
Quote this message in a reply
02-27-2018, 04:39 PM
Post: #2
RE: units of variables?
This doesn't answer your question, but "kg" is not a unit of force. 1 bar is 10^5 N / m^2 or 10 N / cm^2. 1 kg does weigh about 10 newtons (9.81 N, in fact) but it is a mass, not a force. If you insist on using it instead of newtons you could write "kgf" for "kilogram-force", meaning a force equal to the weight of 1 kg in standard gravity. 1 kgf / cm^2 still won't be 1 bar, though.

Sorry - I teach Physics; I can't help it!

Nigel (UK)
Find all posts by this user
Quote this message in a reply
02-27-2018, 05:35 PM
Post: #3
RE: units of variables?
Storing numbers with units doesn't seem to work with REAL Variables (Capital A, B, C, etc...). However, when you create a user variable (ME, MPG, lowercase f, etc...) you can store a number with a unit there. I have only tested this in the HOME View in RPN mode.

For example, in HOME View & in RPN mode...

[ALPHA] [Shift] f [ENTER] OK (to confirm the creation of a user variable) 45 [Shift] Units Mass kg [ENTER] [Shift] [ ' ] [ALPHA] [Shift] f [ENTER] [Shift] Sto->
Find all posts by this user
Quote this message in a reply
02-27-2018, 05:44 PM (This post was last modified: 02-27-2018 05:46 PM by DrD.)
Post: #4
RE: units of variables?
(02-27-2018 11:58 AM)sinan oz Wrote:  I could had chance to put units on variables in my HP 50G , but couldn't do it at my hp prime yet and could find any document how to do... .
What I want to do: I am making my own application. Example on a simple equation P= F/A
F variable must be kg and A variable must be cm2 and the result P will be bar or kg/cm2
thanks in advance...

Just multiply values by 1_unit:

(For example):
Code:

f:=5; a:=1;
f:=f*1_kg;  a:=a*1_cm^2;
p:=f/a;

p = 5_(kg/cm^2) {Don't use reserved variables!}
Find all posts by this user
Quote this message in a reply
02-28-2018, 06:24 AM
Post: #5
RE: units of variables?
Hello,

Home A-Z variable are type specific and can ONLY contains reals.
Indeed, if you want to store numbers with units, you will have to do this in non typed variables such as a user home variable.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
03-01-2018, 02:19 PM
Post: #6
RE: units of variables?
Thanks to everybody , but all are not working ...
when I enter a unit in home mode it gets it but when I go to application mode the value of my variable turns to a number without units. I could not do unit change within application (solve) mode it says: "error:invalid input ".
Any suggestions? thanks in advance once more.
Find all posts by this user
Quote this message in a reply
03-01-2018, 07:34 PM
Post: #7
RE: units of variables?
The solve app does not currently support units. Sorry!

Hans equation solver does from memory. Might be wrong on that.

https://www.hpcalc.org/details/7777

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
03-02-2018, 10:34 AM
Post: #8
RE: units of variables?
(03-01-2018 07:34 PM)Tim Wessman Wrote:  The solve app does not currently support units. Sorry!

That's a bit of a step backwards, don't you think? The solver on the HP 50g does...
Find all posts by this user
Quote this message in a reply
03-02-2018, 04:51 PM
Post: #9
RE: units of variables?
(03-02-2018 10:34 AM)grsbanks Wrote:  
(03-01-2018 07:34 PM)Tim Wessman Wrote:  The solve app does not currently support units. Sorry!

That's a bit of a step backwards, don't you think? The solver on the HP 50g does...

Yes, it just hasn't been on the top of the priority since Prime has always had a worldwide focus and unit conversions basically only gets used in the USA.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
03-03-2018, 01:36 AM
Post: #10
RE: units of variables?
(03-02-2018 04:51 PM)Tim Wessman Wrote:  
(03-02-2018 10:34 AM)grsbanks Wrote:  That's a bit of a step backwards, don't you think? The solver on the HP 50g does...

Yes, it just hasn't been on the top of the priority since Prime has always had a worldwide focus and unit conversions basically only gets used in the USA.

For me the appeal of units on the 50g goes beyond simple conversion to the combination of units. So multiplying a torque by RPM to get power or other such combinations. This would apply world wide :-)
Find all posts by this user
Quote this message in a reply
03-03-2018, 03:07 AM
Post: #11
RE: units of variables?
This is used in many places, I think. In the physics courses it is necessary to work with units, for example in projectile movement problems, or magnetic fields and many things, it is necessary to enter the units of the different physical magnitudes, and then solve a particular equation. It would be great if the Prime could do the same as the 50g, which works the solver of equations with the units and when solving the unknown one also gives the answer with the correct unit. Maybe for an update of the HP Prime ...
Find all posts by this user
Quote this message in a reply
03-03-2018, 09:29 AM
Post: #12
RE: units of variables?
(03-02-2018 10:34 AM)grsbanks Wrote:  
(03-01-2018 07:34 PM)Tim Wessman Wrote:  The solve app does not currently support units. Sorry!

That's a bit of a step backwards, don't you think? The solver on the HP 50g does...

I am really disappointed about this missing on new version. Future goes backwards Smile
Find all posts by this user
Quote this message in a reply
03-03-2018, 09:36 AM
Post: #13
RE: units of variables?
Hello
Just a curiosity of this new version:
When I tried to convert m/s into Km/h like: 1_m/s►1_km/h gives an error (“bad argument type” on the calculator, “Syntax error” on the computer with Windows)

When done with CONVERT it works perfectly.

With other units the operator ► works nice

I do not know if this is a problem with my calculator and, anyway is not really important.

Thanks
Find all posts by this user
Quote this message in a reply
03-03-2018, 09:43 AM (This post was last modified: 03-03-2018 09:43 AM by salvomic.)
Post: #14
RE: units of variables?
(03-03-2018 09:36 AM)Tonig00 Wrote:  Hello
Just a curiosity of this new version:
When I tried to convert m/s into Km/h like: 1_m/s►1_km/h gives an error (“bad argument type” on the calculator, “Syntax error” on the computer with Windows)

When done with CONVERT it works perfectly.

With other units the operator ► works nice

I do not know if this is a problem with my calculator and, anyway is not really important.

Thanks

Last version: using [Sto ►] soft-key it works:
1_m/s [Sto ►] km/h
3.6_km/h

Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)