handle negative temperatures

handle negative temperatures - Mensajes

#1 Publicado: 14/4/2021 12:15:17
brotjob

brotjob

7 me gusta en 71 mensajes.

Grupo: User

Hi there!
How do I handle negative temperatures correctly? My example works for positive values but negative values seem to be treated differently.
negative temperatures.png
#2 Publicado: 14/4/2021 14:03:01
sergio

sergio

127 me gusta en 342 mensajes.

Grupo: User

In fact it looks like a bug. I believe it is due to the order of precedence of the multiplication given to the unit of measurement that is anticipated to the sign. in fact using the brackets it works properly.
SMathStudio_Desktop_B8cyTXTxKo.png
sergio
A 1 usuarios les gustó este mensaje
brotjob 14/4/2021 16:27:00
#3 Publicado: 14/4/2021 15:40:31
Arie

Arie

94 me gusta en 285 mensajes.

Grupo: User

Untitled.png

This works.
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#4 Publicado: 14/4/2021 17:15:18
brotjob

brotjob

7 me gusta en 71 mensajes.

Grupo: User

Thank you for the different replies!
@Jean Giraud: Not to use units is a no go for me. Mars missions have crashed because of this. And I need the units at a different point in my calculation.

@Sergio and alyles: That looks promising and I indeed think it is a bug related to precedence of multiplications. However, in my real calculation I use the temperature as a variable and thus your workarounds do not apply. The workaround with the Delta breaks the function for positive values. Other ideas?

BTW we talk about the magnus formula for saturated vapour pressure over plain water.
negative temperatures v2.png

negative temperatures v3.png

I created a bugzilla issue.
#5 Publicado: 14/4/2021 18:24:55
overlord

overlord

600 me gusta en 1.381 mensajes.

Grupo: Moderator

Wrote

Thank you for the different replies!
However, in my real calculation I use the temperature as a variable and thus your workarounds do not apply. The workaround with the Delta breaks the function for positive values. Other ideas?


Try to get negative value of temperature into a bracket. Not doing so cause the issue.
Minus sign before temperature without bracket performed as multiplication of 5°C with -1.
5°C is considered as 278.15K in SMath thus that way of defining variable resulted to -278.15K.
Could this be considered as bug, maybe. Maybe not. SMath first multiply units with number just before them I guess.
Before any of operations units are performed first, it seems this makes the contradiction.

Regards

2021-04-15_00-19.png
A 1 usuarios les gustó este mensaje
brotjob 15/4/2021 8:45:00
#6 Publicado: 15/4/2021 8:55:11
brotjob

brotjob

7 me gusta en 71 mensajes.

Grupo: User

Thanks overlord. This works for me. It just looks confusing to the inexperienced reader.
  • Nuevos mensajes
  • Sin mensajes nuevos