Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline dardard  
#1 Posted : 17 March 2010 16:34:28(UTC)
dardard

Rank: Newbie

Groups: Registered
Joined: 17/03/2010(UTC)
Posts: 3
Location: France

First, 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.

Regards

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Andrey Ivashov  
#2 Posted : 17 March 2010 18:25:51(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Hello.

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.
Offline dardard  
#3 Posted : 17 March 2010 19:00:43(UTC)
dardard

Rank: Newbie

Groups: Registered
Joined: 17/03/2010(UTC)
Posts: 3
Location: France

Feel free to send me the file for translation.
I will do my best on it. It's my pleasure if I could help the project.

Best regards
Offline Andrey Ivashov  
#4 Posted : 17 March 2010 19:40:24(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
Thank you! I've sent the file to you through Private Messages.
Offline omorr  
#5 Posted : 17 March 2010 19:47:43(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello,
dardard wrote:
First, 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
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline maweilian  
#6 Posted : 17 March 2010 21:09:24(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
omorr wrote:
You 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.
Will Massie
Mechanical Engineer
Oregon, USA
Offline omorr  
#7 Posted : 17 March 2010 21:44:46(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Sorry dardard, I should have explained this as Will did.

Thanks Will Good

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline dardard  
#8 Posted : 17 March 2010 22:43:01(UTC)
dardard

Rank: Newbie

Groups: Registered
Joined: 17/03/2010(UTC)
Posts: 3
Location: France

Thank you for the explanations.
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,
Offline Greg Locock  
#9 Posted : 18 March 2010 16:23:46(UTC)
Greg Locock


Rank: Advanced Member

Groups: Registered
Joined: 30/08/2009(UTC)
Posts: 52
Location: Australia

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

Offline maweilian  
#10 Posted : 18 March 2010 22:01:51(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Greg Locock wrote:
There 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,

maweilian wrote:
temp1 - 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 Confusion .

Edited by user 18 March 2010 22:07:12(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline omorr  
#11 Posted : 18 March 2010 22:50:28(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello 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

Edited by user 18 March 2010 23:05:37(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline omorr  
#12 Posted : 19 March 2010 17:36:39(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Here are few hints related to temperature scales and expression with inconsistent units:



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.
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Andrey Ivashov  
#13 Posted : 19 March 2010 18:12:52(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
omorr wrote:
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.

Thank you. Reproduced. Will fix.
Offline maweilian  
#14 Posted : 19 March 2010 21:32:27(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
omorr wrote:
Hello 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:


Edited by user 25 March 2010 20:25:44(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline omorr  
#15 Posted : 19 March 2010 22:14:36(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Hello 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

Edited by user 19 March 2010 22:22:31(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline maweilian  
#16 Posted : 19 March 2010 22:58:33(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
omorr wrote:
Hello 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.

Edited by user 19 March 2010 23:04:59(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Offline omorr  
#17 Posted : 19 March 2010 23:54:50(UTC)
omorr


Rank: Administration

Groups: Registered, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,740
Man
Serbia

Was thanked: 318 time(s) in 268 post(s)
Yes Will, I understand your point (I mean on relative and apsolute temperature scales). This way the results which include units remaine to the user to conclude if they are correct or not. It is working this way and do not know if something could be done in order to make it better.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Greg Locock  
#18 Posted : 20 March 2010 05:32:07(UTC)
Greg Locock


Rank: Advanced Member

Groups: Registered
Joined: 30/08/2009(UTC)
Posts: 52
Location: Australia

Negative 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.
Offline maweilian  
#19 Posted : 22 March 2010 22:56:35(UTC)
maweilian


Rank: Advanced Member

Groups: Registered
Joined: 09/01/2010(UTC)
Posts: 102
Man
United States
Location: Oregon, USA

Was thanked: 5 time(s) in 5 post(s)
Greg Locock wrote:
Negative 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".

Edited by user 22 March 2010 22:58:17(UTC)  | Reason: Not specified

Will Massie
Mechanical Engineer
Oregon, USA
Users browsing this topic
Guest
Similar Topics
Variable assignment bug? (Bugs & Problems)
by andrei 01/03/2010 16:01:23(UTC)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.