1 Pages (8 items)
Removing Units - How to remove units - Messages
#1 Posted: 1/22/2024 10:28:49 PM
I'm fairly certain this has been discussed before, but I can't seem to find the conversation. I'm trying to remove the units of a variable without changing the value. However, I don't know what the units of the variable are prior to removing them.
For example, say I want to enter L = 1 foot. If I try to remove the units using "UnitsOf" command and dividing then it thinks the units are meters and I will get 0.3048 instead of "1".
Thanks!
For example, say I want to enter L = 1 foot. If I try to remove the units using "UnitsOf" command and dividing then it thinks the units are meters and I will get 0.3048 instead of "1".
Thanks!
#2 Posted: 1/22/2024 11:10:58 PM
Select all the document ... click Ignore units
#3 Posted: 1/23/2024 6:36:52 PM
Once you store a variable, everything is converted into base units. To obtain the value for whatever unit, you just divide the variable by that unit.
If you want to keep the info about the original unit, you have to store it in a separate variable.
If you want to keep the info about the original unit, you have to store it in a separate variable.
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 users liked this post
Davide Carpi 1/23/2024 8:48:00 PM
#4 Posted: 1/23/2024 9:18:15 PM
WroteOnce you store a variable, everything is converted into base units. To obtain the value for whatever unit, you just divide the variable by that unit.
If you want to keep the info about the original unit, you have to store it in a separate variable.
↑↑↑ This ↑↑↑
WroteSelect all the document ... click Ignore units
This works only on on direct definitions.
e.g. A:3'in [with ignore units on A definition] will be stored as 3 (dimensionless), but B:3'in and then C:B [with ignore units on C definition] won't work.
The latter would not help RFreund even if it worked, as data is stored in base units, as mentioned by Martin.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#5 Posted: 1/24/2024 2:23:03 AM
WroteSelect all the document ... click Ignore units
There are two more options:
1. Construct in silent units.
2. Construct completely units-less.
Typical Colebrook Pipe data [T/hr, WC, m/s, kW/hr ...]
Everything appropriately instructed.
Table header instructed, renders perfect.
#6 Posted: 1/24/2024 3:36:36 PM
The question is about how to obtain the value associated to a unit from a variable. Having all dimensionsless avoids the problem, but doesn't answer the question.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Posted: 1/24/2024 7:33:51 PM
WroteFor example, say I want to enter L = 1 foot. If I try to remove the units using "UnitsOf" command and dividing then it thinks the units are meters and I will get 0.3048 instead of "1".
Like this, silent Units
Worksheet84 Silent Unit.sm (4 KiB) downloaded 27 time(s).
#8 Posted: 1/25/2024 11:08:03 PM
Greetings,
Just a few notes of interest:
Therefore: you can create a custom unit of 'FOOT; the variable assigned units of 'FOOT will stay as 'FOOT and UoM() can be used to extract 'FOOT from the variable (however, it will not interact with other units of length as it should.
I would not advise taking the 'make everything unitless' as I have found many an error from which units are displayed on result; but to each their own.
May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
Just a few notes of interest:
- Functions that extract units:
- UnitsOf() - built in units
- UoM() - built in and Custom units
- Default units:
- SMath doesn't allow you to specify your default unit, but you are able to modify the Units.XML file to redefine what your base units are (*A VERY DELICATE/DETAILED PROCEDURE*)
- Display variable with a different unit then 'default':
- For every output, there is a placeholder to the right of the result (when selected); you can enter your unit of choice into this placeholder and the result will display as if that unit is used.
- You will need to specify for each equation/result which value you want displayed.
- You can create your own custom unit, by default: it is a 'base unit' and will behave as intended.
- You cannot associate it with built-in units, else they will simplify; you will need to keep this unit structure independent of other units.
- UoM() will produce the base-custom unit of your variable.
Therefore: you can create a custom unit of 'FOOT; the variable assigned units of 'FOOT will stay as 'FOOT and UoM() can be used to extract 'FOOT from the variable (however, it will not interact with other units of length as it should.
I would not advise taking the 'make everything unitless' as I have found many an error from which units are displayed on result; but to each their own.
May this be of Good Help;
⚜ Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
1 users liked this post
ioan92 1/26/2024 1:09:00 AM
1 Pages (8 items)
-
New Posts
-
No New Posts