Message Boards Message Boards

0
|
3018 Views
|
15 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Converts degrees Celcius to Kelvins without prompting

Posted 1 year ago

Using version 13.2, Mathematica converts degrees Celcius to Kelvins without prompting:

{4*Quantity[20, "DegreesCelsius"], C -> Quantity[1,  "Kilojoules"]/(Quantity[1, "Kilograms"] Quantity[1, "DegreesCelsius"])}

{Quantity[5863/5, "Kelvins"], C -> Quantity[20/5483, ("Kilojoules")/("Kelvins" "Kilograms")]}

This is certainly not correct.
Regards,
Sinval

POSTED BY: Sinval Santos
15 Replies
Posted 1 year ago

Thanks again for your attention Gianluca.

POSTED BY: Sinval Santos

Sorry, I meant 4*Quantity[20, "DegreesCelsius"] in MMA 13.2: it gives the same output as

UnitConvert[Quantity[20, "DegreesCelsius"], "Kelvins"]*4

Kelvin degrees can be multiplied by a number.

POSTED BY: Gianluca Gorni
Posted 1 year ago

I am grateful for the information, Gianluca and Eric. I will check the modifications contained in version 13.2 and adapt my notebook.

Regards,

Sinval

POSTED BY: Sinval Santos

It makes no sense to multiply a Celsius temperature by a coefficient. Version 13.2 has introduced temperature differences, and the behaviour in such situations has changed. The unexpected output happens on MacOS 13.1 with just this input:

4*Quantity[20, "DegreesCelsius"]

With Mathematica 13.2 try this instead:

4*Quantity[20, "DegreesCelsiusDifference"]
POSTED BY: Gianluca Gorni
Posted 1 year ago

Good point. I was so focused on not being able to reproduce the behavior that I didn't even think about the semantics. I've even run into this before and wondered why sometimes it seems like Quantity units are treated like arbitrary tags. It's almost like you could do Quantity[4, abc] and have subsequent operations just treat abc like a formal variable or something. But anyway, kind of nice that MMA does "the right thing" in the update.

POSTED BY: Eric Rimbey
Posted 1 year ago

I'm running Mathematica version 13.2 on Windows 11.

POSTED BY: Sinval Santos
Posted 1 year ago

Based on Hans' comment, it sounds like it's either version dependent or OS dependent. I'm running Mathematica version 13.1 on MacOS 12.6

POSTED BY: Eric Rimbey
Posted 1 year ago

Thanks Hans for the contribution. Version 13.1 didn't have this problem; appeared in 13.2

POSTED BY: Sinval Santos
Posted 1 year ago

There were no previous calculations. If I restart Mathematica and create a new notebook (starting from scratch) the problem remains.

POSTED BY: Sinval Santos
Posted 1 year ago

I can reproduce what Sinval reports. From his attached notebook:

In version 12.3

enter image description here

In Version 13.2

enter image description here

I am using Windows 11

POSTED BY: Hans Milton
Posted 1 year ago

I tried using Ctrl+= as well as Quantity. I get no implicit conversions. And again, if I evaluate your cells in place, I do not get the outputs you had in there originally.

I also notice that your outputs are actually wrong in the sense that if a conversion had occurred, it's faulty (which seems even worse than implicit conversion itself). Specifically, 80 degrees celcius is closer to 350 kelvins than to the over 1100 kelvins that appears in your notebook.

So, my first suspicion is that there were some previous calculations that you haven't shown us that set up some variables or functions that are being applied in these expressions. (You could test this by killing and restarting the kernel.)

If that's not it, then maybe there is some setting/preference that is set differently in your environment than in mine. Maybe there are options for automatically converting certain units. Seems unlikely, but I'm just brainstorming here.

POSTED BY: Eric Rimbey
Posted 1 year ago

In my notebook, I entered the units using the Quantity function or the Ctrl + = keys. Look again at the attached notebook.

Attachments:
POSTED BY: Sinval Santos
Posted 1 year ago

Hello, Eric. I am sending, in attachment, a simple notebook.

Attachments:
POSTED BY: Sinval Santos
Posted 1 year ago

Well, we need more information on how you got to that state. If I execute the cell in that notebook the output uses Celsius, i.e. no conversion. I don't know how the original output was generated, but I cannot reproduce any implicit conversions with what you've provided so far.

POSTED BY: Eric Rimbey
Posted 1 year ago

I'm not seeing any conversion happening for those expressions. What were you expecting to see?

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract