Variable assignment bug - Сообщения
But anyway, I have found an annoying thing when playing with units.
The problem appear in either beta versions of Smath.
I don't know how to put images on topics, so :
try this
temp1:=150°C
temp2:=45°C
temp3:=0,8.temp1
result temp3=65,37°C (instead of 120°C)
temp4:=temp1-temp2
result temp4=-168,15°C (instead of 105°C)
The results are good if I do not use the units.
Maybe I am not doing things in the right way.
Regards
Thank you, dardard. Can't check it now, but will do in the evening and will inform you what is going on here.
Btw, I see you from France... can I ask you to help us to update French translation? If you have a time I can send a file with all non-translated text to you. Thanks in advance.
Best regards, Andrey Ivashov.
I will do my best on it. It's my pleasure if I could help the project.
Best regards
WroteFirst, I want to thank you for all the excellent job done.
But anyway, I have found an annoying thing when playing with units.
The problem appear in either beta versions of Smath.
I don't know how to put images on topics, so :
try this
temp1:=150°C
temp2:=45°C
temp3:=0,8.temp1
result temp3=65,37°C (instead of 120°C)
temp4:=temp1-temp2
result temp4=-168,15°C (instead of 105°C)
The results are good if I do not use the units.
Maybe I am not doing things in the right way.
You should not use relative temperature scales in arithmetic operations. It is wrong.
Regards,
Radovan
WroteYou should not use relative temperature scales in arithmetic operations. It is wrong.
Just to further explain what Radovan means here.
To perform arithmetic operations with Celsius temperatures, the temperature values must first be converted to Kelvins, the arithmetic operations performed, and then the results can be converted back to degrees Celsius. Thus,
temp1 = 150 degrees C = 423.15 K
temp2 = 105 degrees C = 318.15 K
0.8*temp1 = 0.8*423.15 K = 338.52 K = 65.37 degrees C
temp1 - temp2 = 423.15 K - 318.15 K = 105 K = -168.15 degrees C
So, anyway. There is no problem with the results provided by the software. The relative temperatures are being converted to absolute temperatures and back again behind the scenes.
Thanks Will

Regards,
Radovan
I have made a try with the use of Kelvin values and it works well.
The only drawback is when you have formulas with multiplication/division the parameters must be adjusted.
For instance, my example of temp1*0,8 en celsius is not equal in kelvin so the 0,8 must be changed to 0,9338.
This is because 150°*0,8+273,15 is not equal to (150+273,15)*0,8.
I don't know how to handle this in the easy way.
Regards,
WroteThere is no physically valid equation that uses something like 0.8*21 deg C. In engineering if you need to do sums like that you need to use absolute temperatures (Rankin or Kelvin).
What Greg says is most certainly true. In engineering and scientific applications, absolute temperatures must be used. Any relative temperature must first be converted before being plugged into any formulas.
However, the results provided by the software for the difference of temperatures,
Wrotetemp1 - temp2 = 423.15 K - 318.15 K = 105 K = -168.15 degrees C
is surely incorrect when viewed from a different perspective. Since the operation involves finding the difference in two temperatures, the result is no longer absolute. And since a difference of one Kelvin is equal to a difference of one Celsius degree, it would be equally correct to say:
temp1 - temp2 = 150 degrees C - 45 degrees C = 105 degrees C
OR
temp1 - temp2 = 423.15 K - 318.15 K = 105 K
So, when finding the difference in temperatures, the software actually is giving a faulty answer in giving the following results:
temp1:=150 deg C
temp2:=45 deg C
temp1-temp2=-168.15 deg C
Thus, showing that my previous, much-too-broad statement about there being no problem with the results, may very well be incorrect

Do not worry about this. I do not have here the recent version of SMath but try this:
dC:=1*K //1degC = 1K
temp1:=150*degC
diffT1:=temp1 - 20*dC
diffT1 =
diffT2:=temp1 + 30*dC
diffT2 =
(-50)*degC + 20*dC =
(-50)*degC - 20*dC =
and reperesent teh results in degC.
I tried this and I think the results would all be Ok. The same should be with degF and R.
Your example is not correct:
temp1 - temp2 = 150 degrees C - 45 degrees C = 105 degrees C
it should be:
temp1 - temp2 = 150 degrees C - 45 degrees C = 105 dC
This should be wrong:
temp1:=50*degC
temp2:=20*degC
temp1:=temp1+temp2
Regards,
Radovan
PS. Will, please check it out
Regards,
Radovan
PS. Pay attention. When the color of the region with units variable (default blue) or text variable (default red) has been changed, then you can not get the colors back. See the example above with grades Celsius (units are in black color, and you can not make them blue anymore). At least, I think there is no way of doing that yet.
Also, if you change the default text color (black), then everything will be in that color. There will be no difference in text, math and units.
WroteWhen the color of the region with units variable (default blue) or text variable (default red) has been changed, then you can not get the colors back.
Thank you. Reproduced. Will fix.
WroteHello Will,
Do not worry about this. I do not have here the recent version of SMath but try this:
dC:=1*K //1degC = 1K
temp1:=150*degC
diffT1:=temp1 - 20*dC
diffT1 =
diffT2:=temp1 + 30*dC
diffT2 =
(-50)*degC + 20*dC =
(-50)*degC - 20*dC =
and reperesent teh results in degC.
I tried this and I think the results would all be Ok. The same should be with degF and R.
Your example is not correct:
temp1 - temp2 = 150 degrees C - 45 degrees C = 105 degrees C
it should be:
temp1 - temp2 = 150 degrees C - 45 degrees C = 105 dC
This should be wrong:
temp1:=50*degC
temp2:=20*degC
temp1:=temp1+temp2
Regards,
Radovan
PS. Will, please check it out
Radovan,
Thanks for the response above. Your solution (representing the difference of temperatures as deltaC and defining that as a unit) is a good answer to the difficulty I mentioned previously. For the benefit of all, I will include a screenshot of my attempt to test the first part of what you showed above in Smath:

However, when I tested the next expressions in your example above I came across some unusual results:

The answers are incorrect AND the answers are in negative Kelvins, which is impossible. I think that an error should be produced before displaying a negative answer with absolute temperature units.
The answer is incorrect because Smath is not processing the Celsius temperature a -50 degC, but as -(50 degC). So the 50 degC is converted to Kelvins and then the negative sign is applied. I cannot figure out how to correct this problem. See below:

This will certanly be beneficial for other users, thank you.
The negative Celsius and Fahrenheight should be inserted as negative values inside parantheses multiplied by temperture unit
(-50)*degC
or
(-50)*degF
Multiplication here must be inserted. I think you forgot to do that. It seems that everything else, as you tested, should be incorect.
I am sorry, I've tryed this few days ago and it was Ok, but forgot again to double check this at my office.
Regards,
Radovan
WroteHello Will,
This will certanly be beneficial for other users, thank you.
The negative Celsius and Fahrenheight should be inserted as negative values inside parantheses multiplied by temperture unit
(-50)*degC
or
(-50)*degF
Multiplication here must be inserted. I think you forgot to do that. It seems that everything else, as you tested, should be incorect.
I am sorry, I've tryed this few days ago and it was Ok, but forgot again to double check this at my office.
Regards,
Radovan
Thanks again for the response. Multiplying the value in parentheses by the unit does fix the problem.
However, I think that this workaround, although acceptable, is not the best solution. The engineering calculator I use actually has a special key for inserting a "negative sign" and a separate key for inserting a "subtraction operator". When displayed on the screen, the "negative sign" appears slightly shorter and is quite close to the number to which it belongs, and the "subtraction operator" is longer and is separated by a space from the numbers on either side of it. This solution would look much nicer and cleaner on the screen or printed on paper versus having to use parentheses and a multiplication operator (it also would reduce the number of keystrokes).
Also, I think that negative values with absolute temperature units should not be allowed.
Just my opinion.
Regards,
Radovan
WroteNegative temperature differences are valid, for example if you are summing a radiation absorption problem, so it isn't quite as simple as saying that negative results are invalid.
Greg,
This is true. Good point. I withdraw my statement regarding the invalidity of a negative result for absolute temperature values.
But, I still stand by my previous comments regarding the usefulness of a solution to distinguish between a "negative sign" and a "subtraction operator".
-
Новые сообщения
-
Нет новых сообщений