1 Pages (6 items)
Accuracy with units - Messages
#1 Posted: 7/16/2010 1:21:38 PM
I have a small problem with mod function when using US/Imperial units.
For values without units or SI units the mod function works file. But if I specify US/Imperial units the precision causes the mod function to give different results.
Any suggestions?
Also I would like to add a special character to variable names to signify a temporary variable or a parameter passed to a user defined function. I've tried # but sometimes it says function not defined. Any recommendation of a safe special character?


For values without units or SI units the mod function works file. But if I specify US/Imperial units the precision causes the mod function to give different results.
Any suggestions?
Also I would like to add a special character to variable names to signify a temporary variable or a parameter passed to a user defined function. I've tried # but sometimes it says function not defined. Any recommendation of a safe special character?


Ed
#2 Posted: 7/16/2010 2:47:40 PM
It is not because of Units. Problem is that you uses sharp symbol (#) in the expression. Sharp is a special symbol of the program - it means empty placeholder. You can also check it just by hovering of the last amod(..) definition, you'll see an error. Will fix it.
Best regards, Andrey Ivashov.
Best regards, Andrey Ivashov.
#3 Posted: 7/16/2010 3:36:02 PM
Andrey,
There are two screen shots on this page. The first without the "#" shows that mod(5ft,20ft/20) does not produce a whole number. There is approximately 1ft or 0.3048m left over fractionally. Curiously my amod function did produce a whole number.
The second screen shot with the "#" is to show that some characters are not accepted in variable names. Also I discovered some characters on the key board are short cut key strokes. For example "!" is factorial. I tried evey keystroke that I could think of. Most were either short cuts or not recognized.
There are two screen shots on this page. The first without the "#" shows that mod(5ft,20ft/20) does not produce a whole number. There is approximately 1ft or 0.3048m left over fractionally. Curiously my amod function did produce a whole number.
The second screen shot with the "#" is to show that some characters are not accepted in variable names. Also I discovered some characters on the key board are short cut key strokes. For example "!" is factorial. I tried evey keystroke that I could think of. Most were either short cuts or not recognized.
Ed
#4 Posted: 7/16/2010 4:33:11 PM
Ahh, ok.

Actually I don't see an error here, but it seems that option to choose specific Unit system will fix this stuff.
Regards.
Actually I don't see an error here, but it seems that option to choose specific Unit system will fix this stuff.
Regards.
#5 Posted: 7/16/2010 4:59:34 PM
Andrey,
The example you've shown will always give a fractional part.
mod(5,20) is equivalent to the integer of 5/20 = 0 and the remainder is 5 regardless of units.
For mod to work the first argument has to be larger than the second argument. Otherwise it will always return the first argument.
In my example its:
mod(5,20/20) or mod(5,1) which should give 0 but due to precision of units its nearly 1.
For the sake of discussion lets say it's mod(5,2) then the result would be 1. If it were mod(2,5) it would be 2.
The example you've shown will always give a fractional part.
mod(5,20) is equivalent to the integer of 5/20 = 0 and the remainder is 5 regardless of units.
For mod to work the first argument has to be larger than the second argument. Otherwise it will always return the first argument.
In my example its:
mod(5,20/20) or mod(5,1) which should give 0 but due to precision of units its nearly 1.
For the sake of discussion lets say it's mod(5,2) then the result would be 1. If it were mod(2,5) it would be 2.
Ed
#6 Posted: 7/16/2010 5:23:57 PM
Sorry if I didn't understand your point.
It doesn't matter what values you will choose to use as arguments, result will be always the same - Units (if we are talk about not base Units) will always change the result like it shown on the screenshot. Ability to change base Units System will correct the behavior of SMath Studio in that case. If you will enter mod(5*ft,2*ft) (i.e. mod(1.524*m,0.6096*m)) result will be 0.3048 and there is no error here.
Regards.
It doesn't matter what values you will choose to use as arguments, result will be always the same - Units (if we are talk about not base Units) will always change the result like it shown on the screenshot. Ability to change base Units System will correct the behavior of SMath Studio in that case. If you will enter mod(5*ft,2*ft) (i.e. mod(1.524*m,0.6096*m)) result will be 0.3048 and there is no error here.
Regards.
1 Pages (6 items)
-
New Posts
-
No New Posts