cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

15 units rounding rule.

TT_10147243
4-Participant

15 units rounding rule.

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?

1 ACCEPTED SOLUTION

Accepted Solutions

So here is a quick hack, a new function "Round_15" which seems to to what you are asking for.

Werner_E_1-1639529573616.png

 

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

View solution in original post

18 REPLIES 18


@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,

 

https://support.ptc.com/help/mathcad/r7.0/en/index.html#page/PTC_Mathcad_Help%2Ftruncation_and_rounding_functions.html

 

Examples are given in:

 

https://support.ptc.com/help/mathcad/r7.0/en/index.html#page/PTC_Mathcad_Help%2Fexample_truncation_and_roundoff_functions.html%23wwID0EIJZEB

 

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?

Werner_E_0-1639518793642.png

Or are you rather looking for a custom function like

Werner_E_1-1639519443814.png

What should 1 be "rounded" to?

Werner_E_2-1639519607026.png

 

 

 

TT_10147243
4-Participant
(To:Werner_E)

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:

Werner_E_0-1639522330290.png

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.

TT_10147243
4-Participant
(To:Werner_E)

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 "<=".

Werner_E_3-1639530161656.png

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.

Werner_E_1-1639529573616.png

 

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
4-Participant
(To:Werner_E)

Thank you so much! I think this is the right answer. I tested it with many ways and it always gets it right.

TT_10147243
4-Participant
(To:Werner_E)

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? 

Give this function a try - no guarantee!

Werner_E_0-1639577916927.png

 

TT_10147243
4-Participant
(To:Werner_E)

There is again that unit problem. These units are not compatible.

TT_10147243
4-Participant
(To:Werner_E)

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:

Werner_E_0-1639586186140.png

 

TT_10147243
4-Participant
(To:Werner_E)

Thanks, you are best!

LucMeekes
23-Emerald III
(To:TT_10147243)

Searching on internet for the '15 unit rule' brings me:

https://www.jyu.fi/science/en/physics/studies/student-laboratory/rules-for-presenting-the-measured-value-and-the-uncertainty

(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:

https://www.jyu.fi/science/en/physics/studies/student-laboratory/rules-for-presenting-the-measured-value-and-the-uncertainty

(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).

Top Tags