1 Pages (12 items)
Variables with tolerances? - Messages
#1 Posted: 4/29/2010 9:25:18 AM
A feature that would attract a lot of engineers would be the possibility to define a variable with a tolerance, and then get the results with tolerances as well.
It's easier to undertand with an example:
a:=2mm(-0.5 +0.2)
so "a" ranges from 1.5mm to 2.2mm; 2mm is the nominal value
b:=3mm(-0.5 -0.2)
"b" ranges from 2.5mm t0 2.8mm
(in other words a range can be also set only with negative values)
Now, what I would like to have in SMath is that if I multiply the two var I can get automatically the two results:
a*b=6mm2 (-2.25 +0.16)
where:
6 = (a_nominal*b_nominal)
and:
-2.25 =(a_min*b_min)-(a_nominal*b_nominal)
0.16 =(a_max*b_max)-(a_nominal*b_nominal)
For a simple formula like this is pretty obvious to find the results, but when the equations are more complicated it is not that easy to know in advance which combination will lead to the max and min result, so SMath would have to "try all the combinations" and choose max min values.
Of course each ranged variable would expandthe results space, so for example if we have 5 ranged variabiles in our calculation, 2^5+1 results have to be stored internally. (The +1 is the nominal result which shall also handled)
Obviously this is a calculation overhead but with nowadays hardware and with a bit of user judgment in the use of ranged variables this can be done.
Together with units, this would be a killer feature against most of other CAS. Not even Mathcad can do this!
Lots of students and engineers will love it.
I would also be nice to format the results the way in mechanical drawings the tolerances are shown, with the two values in smaller font set like subscript and superscript besides the nominal value.
From the programming standpoint SMath would have to handle the formatting, expand the variable as a vector, evaluate each combination and get max min result and display it properly.
Do you think this can be done?
It's easier to undertand with an example:
a:=2mm(-0.5 +0.2)
so "a" ranges from 1.5mm to 2.2mm; 2mm is the nominal value
b:=3mm(-0.5 -0.2)
"b" ranges from 2.5mm t0 2.8mm
(in other words a range can be also set only with negative values)
Now, what I would like to have in SMath is that if I multiply the two var I can get automatically the two results:
a*b=6mm2 (-2.25 +0.16)
where:
6 = (a_nominal*b_nominal)
and:
-2.25 =(a_min*b_min)-(a_nominal*b_nominal)
0.16 =(a_max*b_max)-(a_nominal*b_nominal)
For a simple formula like this is pretty obvious to find the results, but when the equations are more complicated it is not that easy to know in advance which combination will lead to the max and min result, so SMath would have to "try all the combinations" and choose max min values.
Of course each ranged variable would expandthe results space, so for example if we have 5 ranged variabiles in our calculation, 2^5+1 results have to be stored internally. (The +1 is the nominal result which shall also handled)
Obviously this is a calculation overhead but with nowadays hardware and with a bit of user judgment in the use of ranged variables this can be done.
Together with units, this would be a killer feature against most of other CAS. Not even Mathcad can do this!
Lots of students and engineers will love it.
I would also be nice to format the results the way in mechanical drawings the tolerances are shown, with the two values in smaller font set like subscript and superscript besides the nominal value.
From the programming standpoint SMath would have to handle the formatting, expand the variable as a vector, evaluate each combination and get max min result and display it properly.
Do you think this can be done?
#2 Posted: 4/29/2010 11:24:59 AM
Hello,
I agree this would a very interesting feature. On the other hand, SMath would have to deal with Interval Arithmetic - including units. I do not have a clue how complicated would that be to incorporate into SMath. At the moment, the best you can get concerning some values presented in interval notation might be the Equation system operator combined with plus/minus, minus/plus operator. Here is an example:
Variables a,b,c are actually vectors with two elements. If you, say, multiply a and b you will get the equ.system variable with four elements (see the picture, please).
Regards,
Radovan
I agree this would a very interesting feature. On the other hand, SMath would have to deal with Interval Arithmetic - including units. I do not have a clue how complicated would that be to incorporate into SMath. At the moment, the best you can get concerning some values presented in interval notation might be the Equation system operator combined with plus/minus, minus/plus operator. Here is an example:
Variables a,b,c are actually vectors with two elements. If you, say, multiply a and b you will get the equ.system variable with four elements (see the picture, please).
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#3 Posted: 4/29/2010 11:37:08 AM
Actually I was not aware of the plus/minus operator, it is a wonderful feature :d
What would be missing now is just the capabilty to return only two values instead of 4, and to carry the additional calculation with nominal values only.
(And possibily to specify non symmetric ranges like the plus/minus operator)
What would be missing now is just the capabilty to return only two values instead of 4, and to carry the additional calculation with nominal values only.
(And possibily to specify non symmetric ranges like the plus/minus operator)
#4 Posted: 4/29/2010 12:30:25 PM
I don't know if this is a bug, but if I use the plus/minus operator the max and min function do not return the largest and smallest element in the vector, but the full vector instead:
[LIVE width=369 height=400]http://smath.info/live/?file=1135[/LIVE]
Any hint?
[LIVE width=369 height=400]http://smath.info/live/?file=1135[/LIVE]
Any hint?
#5 Posted: 4/29/2010 2:30:24 PM
Hello,
It might be a bit peculiar to explain and figure out, but I will give it a try. The Equation system is not regarded as a vector in vector/matrix operation. Although you can access the Equ.Sys elements the same way as to a regular vector, SMath makes the difference between Equ.Sys and vector (column matrix) variables. Take a look at the picture please:

You have to transfer the Equ.Sys elements into a regular vector first (for loop). I might be wrong because my observation are based on trial and error. The SMath authors could give you more precise and accurate explanation.
Regards,
Radovan
It might be a bit peculiar to explain and figure out, but I will give it a try. The Equation system is not regarded as a vector in vector/matrix operation. Although you can access the Equ.Sys elements the same way as to a regular vector, SMath makes the difference between Equ.Sys and vector (column matrix) variables. Take a look at the picture please:
You have to transfer the Equ.Sys elements into a regular vector first (for loop). I might be wrong because my observation are based on trial and error. The SMath authors could give you more precise and accurate explanation.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#6 Posted: 4/29/2010 3:12:38 PM
Radovan,
thank you for your explanation. Probably it the simplest solution would be to modify the max min function to let them handle also the Equ.Sys object.
In any case, good to have a workaround, now.
Regards
Andrea
thank you for your explanation. Probably it the simplest solution would be to modify the max min function to let them handle also the Equ.Sys object.
In any case, good to have a workaround, now.
Regards
Andrea
#7 Posted: 4/29/2010 5:56:31 PM
Just an addition.. It could be quite useful with Ohm in electronics too.. 

#8 Posted: 4/29/2010 6:05:26 PM
For example in this (SMath actually suggested 1/s (WOW), but I changed it to Hertz.).

It is easy to show that the percentage +- tolerance is hard to read out of the equation, but that the effect is obvious. A difference in 5 Mhz (13 - 17) with a 10% tolerance resistor?.. :P

It is easy to show that the percentage +- tolerance is hard to read out of the equation, but that the effect is obvious. A difference in 5 Mhz (13 - 17) with a 10% tolerance resistor?.. :P
#9 Posted: 4/30/2010 2:54:56 PM
WroteFor example in this (SMath actually suggested 1/s (WOW), but I changed it to Hertz.).
It is easy to show that the percentage +- tolerance is hard to read out of the equation, but that the effect is obvious. A difference in 5 Mhz (13 - 17) with a 10% tolerance resistor?.. :P
This is what I got:

Changing perc(10,10ohm) gives the same result. (Maybe you have different settings?)
Regards,
Vlad.
#10 Posted: 4/30/2010 3:12:49 PM
Seems, I see a little space between 2 and 4,7 - this means that it is multiplication operator who became invisible because of Units (known bug).
Regards.
Regards.
#11 Posted: 4/30/2010 6:12:59 PM
WroteSeems, I see a little space between 2 and 4,7 - this means that it is multiplication operator who became invisible because of Units (known bug).
Regards.
I thought I saw that, but I said it must be because of font rendering, it seems wider in his screenshot. Ah, well...
Regards,
Vlad.
1 Pages (12 items)
-
New Posts
-
No New Posts