Message Boards Message Boards

0
|
9113 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

MixedRadixQuantity and a lot of problems

Posted 10 years ago

Hello Community! Please excuse my bad English!

I have some problems with the units-system in Mathematica 10, especially with the MixedRadixQuantity-function.

Is it a bug or is it my fault? Here are some examples that didn’t work the way I want:

Problem 1:

MixedRadixQuantity[{1, 2}, {"Meters/Seconds", "Meters/Seconds"}]

Problem 2:

MixedRadixQuantity[{1, 2}, {"Meters/Seconds", "Kilometers/Hours"}]

Problem 3:

MixedRadixQuantity[{1, 2}, {"Meters"^2, "Centimeters"^2}]

Problem 4:

MixedRadixQuantity[{1.414213562373, 1.414213562374}, {"Meters"^Sqrt[2], "Centimeters"^Sqrt[2]}]

Problem 5:

MixedRadixQuantity[{1.414213562373, Sqrt[2]}, {"Meters"^E, "Centimeters"^E}]

Problem 6:

MixedRadixQuantity[{1, 2}, {"Meters"^\[Pi], "Centimeters"^\[Pi]}]

Problem 7:

MixedRadixQuantity[{1, 2}, {"Meters"^\[Infinity], "Centimeters"^\[Infinity]}]

Problem 8:

MixedRadixQuantity[{1, 2, 3}, {"Meters"^2, "Hectares","Liters"^(2/3)}]

Problem 9:

MixedRadixQuantity[{Sqrt[-2], \[Infinity]}, {"Meters"^E*Sqrt[-2]+\[Pi]+\[Infinity]*I, "Centimeters"^E*Sqrt[-2]+\[Pi]+\[Infinity]*I}]

Problem 10:

MixedRadixQuantity[{Sqrt[2] - E^Pi I, \[Infinity] + Sqrt[-1],1}, {"Liters"^(2/3), "Barns", "Meters"^2}]

Problem 11:

MixedRadixQuantity[{Re[1 + \[Infinity] I],Im[\[Infinity] + I]}, {"Meters"^1.414213562373, "Centimeters"^1.414213562373}]

Problem 12:

MixedRadixQuantity[{Sqrt[2], 1}, {"Meters", "Centimeters"}]

Problem 13:

MixedRadixQuantity[{\[Infinity], \[Infinity]}, {"Meters","Centimeters"}]

Problem 14:

MixedRadixQuantity[{1, 2}, {"Meters"^Re[2 + \[Infinity] I],"Centimeters"^Im[\[Infinity] + 2 I]}]

Problem 15:

MixedRadixQuantity[{1, Sqrt[2], Sqrt[3], Sqrt[4], Sqrt[5], Sqrt[6], Sqrt[7], Sqrt[8], Sqrt[9], Sqrt[10], Sqrt[11], Sqrt[12], Sqrt[13], Sqrt[14], Sqrt[15], Sqrt[16], Sqrt[17], Sqrt[18], Sqrt[19], Sqrt[ 20], Sqrt[21], Sqrt[22], Sqrt[23], Sqrt[24], Sqrt[25], Sqrt[26],Sqrt[27], Sqrt[28], Sqrt[29], Sqrt[30], Sqrt[31], Sqrt[32], Sqrt[33], Sqrt[34], Sqrt[35], Sqrt[36], Sqrt[37], Sqrt[38], Sqrt[39], Sqrt[40], Sqrt[41], Sqrt[42], Sqrt[43], Sqrt[44], Sqrt[45], Sqrt[46], Sqrt[47], Sqrt[48]}, {"UniverseAge", "PlatonicYears", "Millennia", "Centuries", "MetonicCycles", "Saros", "Decades", "Olympiads", "AnomalisticYears", "SiderealYears", "JulianYears","GregorianYears", "TropicalYears", "Years", "LunarYears", "Seasons", "GregorianMonths", "Months", "SynodicMonths", "LunarMonths", "AnomalisticMonths", "SiderealMonths", "TropicaMonths","DraconianMonths", "Weeks", "LunarDays", "MartianSolarDays", "Days","SiderealDays", "JovianSolarDays", "Hours", "SiderealHours", "Moments", "Minutes", "SiderealMinutes", "Seconds", "SiderealSeconds", "Deciseconds", "Centiseconds", "Milliseconds","Microseconds", "Nanoseconds", "Picoseconds", "Femtoseconds","Attoseconds", "Zeptoseconds","Yoctoseconds", "PlanckTime"}]

I hope everyone knows what I want to compute by looking at the code from above. I dont know what I can do to fix this problems.

The problems often occurs when:

  • the QuantityUnits are composed like "Meters/Seconds"

  • the QuantityUnits have an exponent that is different from 1 like in "Meters"^2 or "Liters"^(2/3)

  • the QuantityMagnitudes are like Sprt[2]

  • the functions Re[] or Im[] are used with infinity as argument

Can anyone help me? Are this problems known bugs or wrong inputs with errors? Please excuse my bad English!

Best Regards and Thanks!

POSTED BY: Vorname
3 Replies

The examples with non-integer powers are not considered Quantity objects, even if they format nicely.

In[1]:= Quantity[3, "Meters"^Sqrt[2]]                                                   

                          Sqrt[2]
Out[1]= Quantity[3, Meters       ]

In[2]:= QuantityQ[%]                                                                    

Out[2]= False

The more ordinary examples such as

MixedRadixQuantity[{1, 2}, {"Meters"^2, "Centimeters"^2}]  

ought to work. I reported them to developers.

Thank you for pointing this out.

POSTED BY: Bruce Miller

A minor correction; non-integer powers are acceptable, but only if they're Real or Rational:

In[21]:= QuantityQ[Quantity[3, "Meters"^(2/3)]]
Out[21]= True

In[22]:= QuantityQ[Quantity[3, "Meters"^(2.3)]]
Out[22]= True

In[23]:= QuantityQ[Quantity[3, "Meters"^(2.3 + 3 I)]]
Out[23]= False

In[24]:= QuantityQ[Quantity[3, "Meters"^(E)]]
Out[24]= False

In[25]:= QuantityQ[Quantity[3, "Meters"^(Sqrt[2])]]
Out[25]= False
POSTED BY: Nick Lariviere

These look like bugs to me. MixedRadixQuantity is a constructor that creates Quantity expressions of the form: Quantity[MixedRadix[...],MixedRadix[...]]

It seems to be failing to convert many of these, but you can re-write them in this form and they should work: Quantity[MixedRadix[1, 2], MixedRadix["Meters"^2, "Centimeters"^2]]

Note that "Meters/Seconds" isn't a canonical unit form(it should be "Meters"/"Seconds"):

In[14]:= KnownUnitQ["Meters/Seconds"]
Out[14]= False

In[15]:= KnownUnitQ["Meters"/"Seconds"]
Out[15]= True

This parses automatically in Quantity, but not in MixedRadixQuantity(another probable bug); Also note that while some of these exponents will typeset, they don't work in standard Quantity expressions:

In[18]:= Quantity[1, "Meters"^E] // UnitConvert
Out[18]= UnitConvert[Quantity[1, ("Meters")^E]]

In[19]:= Quantity[1, "Meters"^E] // QuantityQ
Out[19]= False

(I will confess that I'm not quite sure what you're trying to do with these however)

POSTED BY: Nick Lariviere
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