1 Pages (6 items)
Units - gone rogue... - Smath gives you a nod, then uses units of it's own making…. - Messages
#1 Posted: 11/28/2017 10:07:29 PM
Hi,
I am a bottom feeder here: as an engineer I don't do any high flying maths, I just use Smath for repetitive calculations and as a means to set out calcs in a legible manner. As in this case, where I will be needing to discuss a problem with a colleague.
So, I have assessed a loading in a simple calculation and then, for the purposes of future calculations, wanted to ascribe units to the result.
These units happen to be kN (kiloNewtons).
At the end of my result (checked by hand as being correct) I enable the dynamic units assistant, start typing and there it is: "kN", being careful not to select knots, i hit the TAB button to insert.
I see the blue italic of kN in place and hit enter to exit the placeholder, then Smath goes rogue…
It rounds my result and gives it's own interpretation of kN…
Unfortunately for me, I did not want my result rounded and for me, a kN is a kN is a kN….
This has frustrated me in the past, wherein I shake my fist at god and just type the units as text, but is there a way of getting the logical result I was looking for in the first place….??
cheers,
Stuart

I am a bottom feeder here: as an engineer I don't do any high flying maths, I just use Smath for repetitive calculations and as a means to set out calcs in a legible manner. As in this case, where I will be needing to discuss a problem with a colleague.
So, I have assessed a loading in a simple calculation and then, for the purposes of future calculations, wanted to ascribe units to the result.
These units happen to be kN (kiloNewtons).
At the end of my result (checked by hand as being correct) I enable the dynamic units assistant, start typing and there it is: "kN", being careful not to select knots, i hit the TAB button to insert.
I see the blue italic of kN in place and hit enter to exit the placeholder, then Smath goes rogue…
It rounds my result and gives it's own interpretation of kN…
Unfortunately for me, I did not want my result rounded and for me, a kN is a kN is a kN….
This has frustrated me in the past, wherein I shake my fist at god and just type the units as text, but is there a way of getting the logical result I was looking for in the first place….??
cheers,
Stuart
#2 Posted: 11/28/2017 11:09:31 PM
Hello Stuart,
First of all, seems you are running an outdated (and buggy) version of SS (0.98.6179 probably); my suggestion is to switch ASAP to the latest stable version.
SMath provides a dimension consistency check when you type a custom unit in the units' placeholder, therefore when you try to modify the unit of a dimensionless number to something, the inverse multiplies your unit to have the right dimension; in your SS it is obviously buggy because Pascal isn't the inverse dimension of kN (pressure vs force). With latest stable or nighty build you should see:
![2017-11-29 03_16_21-SMath Studio 0.98.6484 - [Bad Unit Correction.sm_].png](/en-US/file/UZ2MsH/2017-11-29-03_16_21-SMath-Studio-0_98_6484---_Bad-Unit-Correction_sm___png)
If your intent is just to display an unit for dimensionles values, thee are several other ways:
![2017-11-29 03_13_45-SMath Studio 0.98.6484 - [Bad Unit Correction.sm_].png](/en-US/file/FBDLCM/2017-11-29-03_13_45-SMath-Studio-0_98_6484---_Bad-Unit-Correction_sm___png)
Or even you can use the units in the definition of G.s ("globally" for the whole variable or "locally" for each term inside it).
![2017-11-29 03_19_49-SMath Studio 0.98.6484 - [Bad Unit Correction.sm_].png](/en-US/file/2YWX7C/2017-11-29-03_19_49-SMath-Studio-0_98_6484---_Bad-Unit-Correction_sm___png)
First of all, seems you are running an outdated (and buggy) version of SS (0.98.6179 probably); my suggestion is to switch ASAP to the latest stable version.
SMath provides a dimension consistency check when you type a custom unit in the units' placeholder, therefore when you try to modify the unit of a dimensionless number to something, the inverse multiplies your unit to have the right dimension; in your SS it is obviously buggy because Pascal isn't the inverse dimension of kN (pressure vs force). With latest stable or nighty build you should see:
If your intent is just to display an unit for dimensionles values, thee are several other ways:
Or even you can use the units in the definition of G.s ("globally" for the whole variable or "locally" for each term inside it).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 11/29/2017 9:09:01 PM
Thanks Davide, that's terrific…!
Take the rest off the day off….!
Take the rest off the day off….!
#4 Posted: 12/3/2017 9:55:11 PM
For anyone that is still watching…
I liked the principle of the, "modified unit in the unit placeholder" (hopefully shown attached…)
This got my most of the way there, but area has been a problem for me ever since I started using Smath..
The units tool has a sub category: "area", but unfortunately area is treated as acres, hectares and the like, so you won't find m^2 or mm^2…
I applied the "modified unit in the unit placeholder" principle to my sheet, but Smath seemed to reject this, see the red box in the attached image and the resulting dimensionless result for my area calc…
Why would this be…..?
(I would add that "D" was entered as a dimensionless number, as it ascribing metres as units become cumbersome in matrix algebra, so was deleted..)
Stuart.
I liked the principle of the, "modified unit in the unit placeholder" (hopefully shown attached…)
This got my most of the way there, but area has been a problem for me ever since I started using Smath..
The units tool has a sub category: "area", but unfortunately area is treated as acres, hectares and the like, so you won't find m^2 or mm^2…
I applied the "modified unit in the unit placeholder" principle to my sheet, but Smath seemed to reject this, see the red box in the attached image and the resulting dimensionless result for my area calc…
Why would this be…..?
(I would add that "D" was entered as a dimensionless number, as it ascribing metres as units become cumbersome in matrix algebra, so was deleted..)
Stuart.
#5 Posted: 12/4/2017 4:45:36 AM
You can only assign to names, variables or functions, not to expressions. 'm^2 is an expression. Assignment to vector or list elements is an exception to this rule, because strictly speaking, indexing is also an operation.
The unit system only defines units, which are pure names, not expressions. If you want the result in 'm^2 you have to type just this in the placeholder.
Indeed matrices with entries of different dimension/unit aren't easy to handle. Some options to mitigate this, are:
- use individual vectors for what would otherwise be the column of a table.
- most matrix functions can handle units very well. Please give an example of what doesn't work as expected
- normalize entries by some arbitrary unit. This approach is used in the example BeamFEA
- the symbolic (CAS) plugins for Maxima and Maple can handle units.

The unit system only defines units, which are pure names, not expressions. If you want the result in 'm^2 you have to type just this in the placeholder.
Indeed matrices with entries of different dimension/unit aren't easy to handle. Some options to mitigate this, are:
- use individual vectors for what would otherwise be the column of a table.
- most matrix functions can handle units very well. Please give an example of what doesn't work as expected
- normalize entries by some arbitrary unit. This approach is used in the example BeamFEA
- the symbolic (CAS) plugins for Maxima and Maple can handle units.
Martin Kraska
Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
1 Pages (6 items)
-
New Posts
-
No New Posts