1
$\begingroup$

I'm no longer able to multiply scalars by quantities in Mathematica 11.3. In previous versions the code

3*Quantity[1, "mm"]

evaluated to

3 mm

Now it returns

3(1 mm)

which throws errors in subsequent calculations.

Multiplying quantities by other quantities still works fine.

Assuming this change is not a bug, but intentional, how am I supposed to multiply quantities and scalars in 11.3?

$\endgroup$

3 Answers 3

3
$\begingroup$

It works on my Mathematica 11.3 on Windows 10 as you expect, i.e. returns

3 mm

Try restarting the kernel.

$\endgroup$
2
$\begingroup$

I saw the behavior like this just yesterday after recently installing Mathematica on that machine. The Duration function applied to an Audio returned a form, IIRC SomeContext`Quantity[SomeContext`UndefinedQuantity[3.141`, "s"]]; I do not remember what the context was. I did not pay much attention to that, as I got the result I wanted, albeit in a weird form; some time after, when I evaluated another expression involving a quantity, I saw a PrintTemporary-generated output cell with a message to the effect "Downloading from Wolfram server (xx%)" with the progress value xx ticking from 0 to 100, and quantities magically began working. I think you are hitting a bug.

Please try to figure out what would trigger the download of the missing package, and file a bug.

$\endgroup$
2
$\begingroup$

This is not an answer, just a comment.

I am experiencing a similar issue but I have noticed it when dealing with time quantities. I have to quit Mathematica to restore the normal behavior. I don't know what triggers it but I have a small notebook on my second monitor with this dynamic expression which I'm hoping will help me figure this out:

Dynamic[If[(-Quantity[1, "Minutes"]) + Quantity[1, "Hours"] == Quantity[59, "Minutes"],
  SetOptions[EvaluationNotebook[], Background -> LightGreen]; "OK",
  SetOptions[EvaluationNotebook[], Background -> Red]; "NOK"], 
 UpdateInterval -> 2]
$\endgroup$
3
  • $\begingroup$ Mine is also about time (see my non-answer). Did you see the download progress as I did, or any of there unevaluated form returned instead of time? Just wondering if we can narrow it down to the level of reproducibility suitable to open a bug case. I, for one, am unable to repro the issue. $\endgroup$ Jul 10, 2018 at 16:34
  • $\begingroup$ During my regular workflow, I rarely see the downloading from wolfram messages. However I use the network functions a lot (HTTPRequest and friends). $\endgroup$ Jul 10, 2018 at 16:42
  • $\begingroup$ I seen these download progress messages while pulling example data, e. g. ExampleData[{"Audio", "Bird"}]. The datum is cached then, so it occurs only once per datum. The quantity somehow caused a very similar behavior, apparently pulling a paclet. And my quantity was the most regular temporal seconds, nothing non-trivial. No idea if quantities displayed at all before that; MMA had been installed on that machine afresh just for a couple hours. So you did not see that, but a full restart of the whole rig helped. Looks like quantities break in different ways to different people. :( $\endgroup$ Jul 10, 2018 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.