Units - gone rogue...

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
studoc

studoc

0 likes in 17 posts.

Group: User

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

rogue units.tiff
#2 Posted: 11/28/2017 11:09:31 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

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

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


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
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 users liked this post
frapuano 11/29/2017 4:39:00 AM, studoc 11/29/2017 9:08:00 PM
#3 Posted: 11/29/2017 9:09:01 PM
studoc

studoc

0 likes in 17 posts.

Group: User

Thanks Davide, that's terrific…!

Take the rest off the day off….!
#4 Posted: 12/3/2017 9:55:11 PM
studoc

studoc

0 likes in 17 posts.

Group: User

For anyone that is still watching…

I liked the principle of the, "modified unit in the unit placeholder" (hopefully shown attached…)mod unit.tiff

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…area.tiff

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
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

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.

2017-12-04 08_42_14-BeamFEA - SMath Studio in the Cloud.png
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#6 Posted: 12/12/2017 4:09:24 AM
studoc

studoc

0 likes in 17 posts.

Group: User

Okay.. thanks....

No SI units for area... got it..

I'll just continue to type them in..
  • New Posts New Posts
  • No New Posts No New Posts