Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline lrb2_  
#1 Posted : 13 September 2021 05:35:59(UTC)
lrb2_

Rank: Newbie

Groups: Registered
Joined: 13/09/2021(UTC)
Posts: 2
United States

I noticed that when I try to use a basic symbolic expression with certain units (particularly U.S. customary) that the symbolic result shows an absurd fraction instead of the whole number that it should be. See the attached image, especially the basic equations at the bottom. These units have factors with more than 8 or so digits. I assume that, when the value is stored, it is being converted to the base unit and truncated, which is then converted to a fraction when it is accessed in symbolic mode. The fractions seem to be less than 10^-13 off per unit.

symbolic_unit.png
symbolic_unit.sm (14kb) downloaded 9 time(s).
* All of the results are in symbolic mode for demonstration purposes.

Is there a good solution to this that I haven't found? I know that if I was only using U.S. customary units, I could replace the Units.xml file, but I often switch between U.S. and metric units depending on the circumstances, so that is not a good option for me. Though I rarely have to convert between U.S. and metric, so I guess I could create my own Units.xml that is based on both U.S. customary and metric simultaneously... (though that solution would be less prone to user error if it was possible to create custom dimensions)

It would be nice if the absurd fractions that are generated would be automatically rounded slightly to account for this inaccuracy. Or maybe if there was an option to show numerical fractions as decimals in symbolic results. Though, in my opinion, it would be best if values were stored without being converted to the base unit, so the value wouldn't have to be converted at all, but that would be a fairly major change.
Offline mkraska  
#2 Posted : 13 September 2021 09:01:54(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,760
Germany

Was thanked: 968 time(s) in 616 post(s)
Originally Posted by: lrb2_ Go to Quoted Post

It would be nice if the absurd fractions that are generated would be automatically rounded slightly to account for this inaccuracy. Or maybe if there was an option to show numerical fractions as decimals in symbolic results. Though, in my opinion, it would be best if values were stored without being converted to the base unit, so the value wouldn't have to be converted at all, but that would be a fairly major change.


Actually there are multiple options to control the result display, have a look at the context menu (right mouse button, when on the result).

Some of these settings have pre-sets, controlled by main menu> tools> options.
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline lrb2_  
#3 Posted : 13 September 2021 09:20:04(UTC)
lrb2_

Rank: Newbie

Groups: Registered
Joined: 13/09/2021(UTC)
Posts: 2
United States

Originally Posted by: mkraska Go to Quoted Post
Actually there are multiple options to control the result display, have a look at the context menu (right mouse button, when on the result).

Some of these settings have pre-sets, controlled by main menu> tools> options.


I did see that, but unless I'm doing something wrong they don't apply in symbolic mode. If I'm not using symbolics, I can be in numeric mode and set "Fractions" to anything but "Fraction" and it will show the value I want. However, this doesn't work in any mode other than numeric -- setting "Fractions" to "Decimal" still shows it as a fraction (and none of the other options seem to take effect either).
Offline dinhviquan10  
#4 Posted : 13 September 2021 11:43:44(UTC)
dinhviquan10

Rank: Newbie

Groups: Registered
Joined: 24/08/2021(UTC)
Posts: 1
Location: ho chi minh

good post
Offline Kenny Lemens  
#5 Posted : 22 August 2022 18:13:38(UTC)
Kenny Lemens


Rank: Advanced Member

Groups: Registered
Joined: 11/01/2018(UTC)
Posts: 42
Man
United States
Location: Wisconsin

Was thanked: 12 time(s) in 8 post(s)
Greetings!

Originally Posted by: lrb2_ Go to Quoted Post
I assume that, when the value is stored, it is being converted to the base unit and truncated, which is then converted to a fraction when it is accessed in symbolic mode.

For the most part, I agree with your analysis.

I've explored your dilemma and you can influence the result to some degree: if you change your base unit, the base unit will display an appropriate fraction/value. See below, I modified both the 「OutputUnitsSystem」 variable of 「%APPDATA%\SMath\settings.inf」 and the data contained within the 「C:\Program Files (x86)\SMath Studio\entries\Units.xml」 file; you can see the extent of the influence:
    - 7000lbf didn't display correctly for Metric, but did for Imperial. However, kip (which has a simple relationship of 1kip = 1000lbf) was not affected.
    - By default 70psi will not simplify to 70psi because base units for Imperial is inHg. However, if you modify the Units.xml file, you can get 70psi = 70psi, but this will be at the cost of inHg no longer simplifying correctly.

      SMath_UnitsPrecision.jpg

If you are dedicated to (1) unit per unit type; editing the Units.xml file to force your units to be the base unit might be your best solution. However, Units.xml is an important file: I wouldn't modify it unless you are confident in what you are doing.


Rather then going down the rabbit hole of tweaking system files/settings, you might be better served by redefining the units themselves. For whatever reason, redefining kip to be 1000lbf within the worksheet itself resulted in a proper symbolic evaluation:

      SMath_UnitsSymbolicWorkaround.jpg



I hope this helps!
-Kenny Lemens, P.E.
Offline Jean Giraud  
#6 Posted : 22 August 2022 23:29:59(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,263
Canada

Was thanked: 915 time(s) in 743 post(s)
Originally Posted by: lrb2_ Go to Quoted Post
It would be nice if the absurd fractions that are generated would be automatically rounded slightly to account for this inaccuracy.

Exponential threshold is limited to 15.
You can freak the inaccuracy
... explain freak to a costumer or published project ! ?
In other type of works ε < 10^-15 is beneficial.

Debye.PNG
Offline Jean Giraud  
#7 Posted : 23 August 2022 14:09:40(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,263
Canada

Was thanked: 915 time(s) in 743 post(s)
... in other words:
the bizarre symbolic is created by the sub unit D processing.
otherwise correct ... 11*'D=3.6692*10^{-29}*m*C
but should be C m
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.