HP Forums

Full Version: units of variables?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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...
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)
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->
(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!}
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
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.
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
(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...
(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.
(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 :-)
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 ...
(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
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
(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
Reference URL's