Minus kelvin

Minus kelvin - лишние скобки - Messages

#1 Posted: 4/30/2023 3:55:23 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

minus-K.png
#2 Posted: 4/30/2023 5:18:37 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Mathsoft had this very sentence ... Watch where you thread.

degC.PNG
#3 Posted: 5/1/2023 12:04:42 PM
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

74 likes in 164 posts.

Group: User

Greetings,

It is important to note that temperature is a variable unit in SMath and not a function as it is in Mathcad.

Regardless, the first line is converting 10°C --> 283.15K; and then applying the unary operator of minus (-) to the value; thus: -283.15K; Make sure you apply the unit °C to -10 and not just 10; use the space bar to group your operations correctly.

When in doubt: use parenthesis for grouping your operations.


May this be of Good Help,
- SK Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#4 Posted: 5/1/2023 12:41:51 PM
Valery Ochkov

Valery Ochkov

55 likes in 633 posts.

Group: User

Wrote

Greetings,

It is important to note that temperature is a variable unit in SMath and not a function as it is in Mathcad.

Regardless, the first line is converting 10°C --> 283.15K; and then applying the unary operator of minus (-) to the value; thus: -283.15K; Make sure you apply the unit °C to -10 and not just 10; use the space bar to group your operations correctly.

When in doubt: use parenthesis for grouping your operations.


May this be of Good Help,
- SK Kenny Lemens, P.E. ᵂᴵ



2+2*2=8
2+(2*2)=6
#5 Posted: 5/1/2023 12:56:33 PM
⚜ Kenny Lemens, P.E. ᵂᴵ

⚜ Kenny Lemens, P.E. ᵂᴵ

74 likes in 164 posts.

Group: User

Greetings,

Wrote

2+2*2=8


I tried to duplicate this result, but was unsuccessful. However, the following will achieve '8':


(2+2)*2=8

or

2*(+2)*2=8


On the larger issue, I would refer you to the following handbook; it can be downloaded via your Extension Manager (i.e., [Tools] -> [Plugins...] -> [Interactive books]):
https://en.smath.com/view/interactivebook/

There is a section that reviews the Priority of operators; you will see that units are level 1, whereas unary is level 2: thus the disconnect for negative numbers.
Expressions with operators of varying priority
Those respective sheets are as follows:
  • File not found.
  • File not found.



May this be of Good Help,
- Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#6 Posted: 5/1/2023 4:13:13 PM
Martin Kraska

Martin Kraska

1222 likes in 2150 posts.

Group: Moderator

This issue is constantly confusing new users. The evil is in the design decision that the unary minus has the same priority as the binary plus and minus, both are less than multiply and divide. This is counter-intuitive. So you have to use parentesis in SMath where you would not expect to need them with pencil and paper. Changing these priority rules might fix the problem (and perhaps cause other ones).
Martin Kraska Pre-configured portable distribution of SMath Studio: https://en.smath.info/wiki/SMath%20with%20Plugins.ashx
#7 Posted: 5/1/2023 8:17:27 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

So you have to use parenthesis in SMath


Golden rule from numerical priority rule(s)
Not unique to this application.
#8 Posted: 6/21/2023 4:16:28 PM
Arie

Arie

93 likes in 285 posts.

Group: User

I've gotten in the habit of using this function. This is probably dumb to do, but it forces me to use parenthesis for all temps.

temp.png
temperature.sm (4 KiB) downloaded 28 time(s).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#9 Posted: 6/21/2023 4:29:58 PM
Arie

Arie

93 likes in 285 posts.

Group: User

Also this function can be useful when variables are defined in Celsius but need to be used relatively.

temp.png
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
#10 Posted: 2/20/2024 7:10:50 PM
miki

miki

0 likes in 1 posts.

Group: User

Wrote

Greetings,

It is important to note that temperature is a variable unit in SMath and not a function as it is in Mathcad.

Regardless, the first line is converting 10°C --> 283.15K; and then applying the unary operator of minus (-) to the value; thus: -283.15K; Make sure you apply the unit °C to -10 and not just 10; use the space bar to group your operations correctly.

When in doubt: use parenthesis for grouping your operations.

Ok

I put my negativ temp like t2=(-43), ant t1=20, all in degC

Now I got this in Smath editor

t1-t2 = 63K it is OK

but t1-t2 = -210,15degC

it works like this: t1-t2 = ((20+273) - (-43 + 273) - 273) = -210,15degC THIS IS WRONG. there should not be extra (-273) on the end when you enter degC in the placeholder of expresion for convert from K to degC


What is right

t1-t2 = 20-(-43) = 63degC

t1-t2 = (20+273) - (-43+273) = 63K

Difference deltaT/deltat do not depend of scale (for degC and K for sure)

so definitely there is a bug in conversion (adlist when conversion is done by manipulating placeholder behind result)

#11 Posted: 2/20/2024 11:12:54 PM
overlord

overlord

547 likes in 1330 posts.

Group: Moderator

Wrote

I put my negativ temp like t2=(-43), ant t1=20, all in degC

Now I got this in Smath editor

t1-t2 = 63K it is OK

but t1-t2 = -210,15degC

it works like this: t1-t2 = ((20+273) - (-43 + 273) - 273) = -210,15degC THIS IS WRONG. there should not be extra (-273) on the end when you enter degC in the placeholder of expresion for convert from K to degC


What is right

t1-t2 = 20-(-43) = 63degC

t1-t2 = (20+273) - (-43+273) = 63K

Difference deltaT/deltat do not depend of scale (for degC and K for sure)

so definitely there is a bug in conversion (adlist when conversion is done by manipulating placeholder behind result)



This is not a bug, this is how SMath works.
You have to use delta temperatures for that kind of calculations.
Unfortunately there is no easier way.

2024-02-20_18-08.png

If you really need to calculate without delta temperatures,
You can use a custom equation/function like this.

Regards

2024-02-20_18-15.png
  • New Posts New Posts
  • No New Posts No New Posts