Can i somehow round my answers with 15 units rounding rule with mathcad prime 7?
What functions i have to use to do that if its able to do?
Solved! Go to Solution.
So here is a quick hack, a new function "Round_15" which seems to to what you are asking for.
I could not use "Ceil" (see "Round_15_(..) in the attached sheet) because this function would not round 1,0 up to 2. So I had to use the old method of adding 0.5 and using the normal "Round" function.
The function has no error checking, so don't feed it with arguments <=0 😉
i have the feeling that this function can be written much more compact and elegant, but...
Prime 6 sheet attached
@TT_10147243 wrote:
Can i somehow round my answers with 15 units rounding rule with mathcad prime 7?
What functions i have to use to do that if its able to do?
Yes, Mathcad Prime 7 has a set of rounding and truncation functions. They are describe in this link,
Examples are given in:
If you just wish to display n places without affecting the value that Mathcad stores, then use the Display Precision dropdown menu in the Math Format tab. The default display precision is 3 decimal places, but it can be set to 15 dp.
Stuart
Thanks for those but i didnt found answer to my task. I have to get mathcad round my error estimate with 15 digit rule.
Like if i have ΔF=2.1069 when its rounded its 3. 15 doesnt fit to 2, 15 fits in 21 then one number back and round upwards to 3
And if ΔF=1.4678 its 1.5. 15 doesnt fit to 1, doesnt fit to 14, fits in 146 one number back and round upwards to 1.5
I know how to do it on paper but how i can get mathcad to do it :DD
Would this do the job?
Or are you rather looking for a custom function like
What should 1 be "rounded" to?
I think that second one does the job but i dont know how to write it. Now it says these units are not compatible.
I added my task if u wanna check it out.
There is Fn and ΔF what needs to be round in same decimals but ΔF needs to be rounded with 15 digit rule first.
You have to cancel the unit in the argument of the logarithm and we have to add the unit to the second argument of the Ceil function:
The units returned by "UnitsOf" are not the units you define a variable with, but rather the standard SI unit used by Prime. You may also use the "SIUnitsOf(..)" function which does the very same.
You sure should give the function a thorough test drive because I am absolutely not sure if this function really does what it should do.
I am not familiar with that kind of rounding and the only source found on the net (http://en.opasnet.org/w/Fifteen-unit_rule_for_rounding_numerical_results) wasn't really helpful for me when I compared it to the procedure you had described.
You had not answered my question about the result when you round 1.00 by your method! Should it be 1.5 as per my function or rather 1.1 as per the method you described (and as I understood it)?
What should 1234.56 be rounded to? 1500 or rather 1300?
And 0.0012345? 0.0015 or 0.0013 or something else?
My function just rounds up to the next multiple of 1.5, 15, 0.00015, 150, ... depending an the magnitude of the input number.
1.00 rounds to 1.1. Like 15 doesnt fit to 1 not in 10 but fits in 100 one number back and rounding upwards
1234.56 rounds to 1300
0.0012345 rounds to 0.0013
https://www.jyu.fi/science/fi/fysiikka/opiskelu/tyoosasto/15-yksikon-saanto
There is the rule how it works but its in finnish. If u can translate that you maybe got it.
If i understand correct then 150 should not yield 200 as in my last function, but rather 160.
This can be achieved by simply exchanging the "<" character for a "<=".
Or should 150 simply stay 150? Guess that is it! 😞
And what a about 90? 90, 91 or 100? Guess it should remain 90. But then, why would 1 end up at 1.1 and does not remain 1? The document is talking about rounding up, but should 1.0 really be rounded up to 1.1 ??
I hate special cases, they make the most work and blow up a function needing a couple of if statements.
So here is a quick hack, a new function "Round_15" which seems to to what you are asking for.
I could not use "Ceil" (see "Round_15_(..) in the attached sheet) because this function would not round 1,0 up to 2. So I had to use the old method of adding 0.5 and using the normal "Round" function.
The function has no error checking, so don't feed it with arguments <=0 😉
i have the feeling that this function can be written much more compact and elegant, but...
Prime 6 sheet attached
Thank you so much! I think this is the right answer. I tested it with many ways and it always gets it right.
One more question 😄 Now mathcad rounds ΔF right. Can i somehow get it round that Fn(d,l) with basic style but same ammount of decimals thats in ΔF?
There is again that unit problem. These units are not compatible.
I think i got it right but not sure, can u check it?
Added file
Yes, I forgot about the units.
Your modification works but the "UnitsOf" in the second program line is wrong. It does not have any effect because "num2str" ignores units anyway but by multiplying with UnitsOf you would get the unit N^2 in your example.
You may omit the "UnitsOf" completely in the second line, but I find it cleaner to "officially" get rid of the unit before applying num2str:
Thanks, you are best!
Searching on internet for the '15 unit rule' brings me:
(I have a hard time understanding that English, some sentences don't appear correct) and
http://en.opasnet.org/w/Fifteen-unit_rule_for_rounding_numerical_results
From what I read in both sources, you can only apply the rule to a number WITH a given measure of accuracy/uncertainty. If not, it would be really foolish to round 2.1064 to 3. E.g. if the uncertainty in it would be 0.00004.
Success!
Luc
@LucMeekes wrote:
Searching on internet for the '15 unit rule' brings me:
(I have a hard time understanding that English, some sentences don't appear correct) and
http://en.opasnet.org/w/Fifteen-unit_rule_for_rounding_numerical_results
From what I read in both sources, you can only apply the rule to a number WITH a given measure of accuracy/uncertainty. If not, it would be really foolish to round 2.1064 to 3. E.g. if the uncertainty in it would be 0.00004.
Success!
Luc
As I understand it, it is just the uncertainty which is rounded that way, not the main, average value.
Its interesting that this kind of rounding seems to only appear in Finnish sources. I had not heard of it until now (which actually does not mean anything, of course).