Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline mkraska  
#1 Posted : 13 September 2012 17:22:23(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
Hi,

The results formatting of engineering computations should reflect their valid precision. Typically, this is assumed to be tree significant digits, perhaps 4 if the leading digit is 1. This is based on the precision of most available input data and in former times that was the achievable precision of the slide rule.

I find myself adjusting the number of digits in the right button menu on a case by case basis and have to correct the settings if Input data changes.

Currently, the only way to enforce a given relative precision independent of the result's order of magnitude is to set the exponential threshold to 1 and to specify the number of digits accordingly. However, the exponential threshold is better used to provide readablity than to control precision.

Very often I get results displayed as zero just because they are smaller than 0.01 and default precision set to 2 digits.

One can use brute force to set the relative precision by defining a function like

format(x_,n_):line(oom:round(log10(x_)-0.5,0),round(x_/{10^oom},n_-1)*10^oom,2,1)

This yields

format(1234563,2)=1200000

format(0.00001234,2)=0.000012


Proposal:
  • Provide a control over the number of significant digits including cases like 1234556 -> 1230000.
  • Include an option to increase it by one if the first digit is 1. Setting "3" would then provide 1234000
  • Include a setting of the global default for the option to retain trailing zeros.
  • Provide control over corresponding default settings


My hope is that this might be useful for other users as well and that it is not too complex to implement.

Best regards, Martin Kraska

Edited by user 27 March 2014 16:07:41(UTC)  | Reason: Found out how to swith on display of trailing zeros in the context menu

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 28/07/2013(UTC)

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline mkraska  
#2 Posted : 28 July 2013 10:54:33(UTC)
mkraska


Rank: Advanced Member

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

Was thanked: 1124 time(s) in 721 post(s)
This proposal is not directly related to the previous one but fits in the topic name.

It is about creating formatted numbers for plot labels, i.e. formatted version of num2str. In the given code, there is just the option to specify decimal places after the delimiter and to specify the delimiter itself. One could easily explode the function into handling of significant digits, complex numbers with polar and rectangular shape, units and the conversion of matrices or lists (systems) in a single call. A nice place for such a function could be the custom funcions plugin, as there are already other string functions included.

File Attachment(s):
Section String Processing.sm (44kb) downloaded 54 time(s).
mkraska attached the following image(s):
format.PNG
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 28/07/2013(UTC)
Users browsing this topic
Guest
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.