0
|
8701 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# MixedRadixQuantity and a lot of problems

Posted 9 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, "Centimeters"^Sqrt}]  Problem 5: MixedRadixQuantity[{1.414213562373, Sqrt}, {"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 - 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, 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, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt[ 20], Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt,Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt, Sqrt}, {"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 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!
3 Replies
Sort By:
Posted 9 years ago
 The examples with non-integer powers are not considered Quantity objects, even if they format nicely. In:= Quantity[3, "Meters"^Sqrt] Sqrt Out= Quantity[3, Meters ] In:= QuantityQ[%] Out= 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 9 years ago
 A minor correction; non-integer powers are acceptable, but only if they're Real or Rational: In:= QuantityQ[Quantity[3, "Meters"^(2/3)]] Out= True In:= QuantityQ[Quantity[3, "Meters"^(2.3)]] Out= True In:= QuantityQ[Quantity[3, "Meters"^(2.3 + 3 I)]] Out= False In:= QuantityQ[Quantity[3, "Meters"^(E)]] Out= False In:= QuantityQ[Quantity[3, "Meters"^(Sqrt)]] Out= False 
Posted 9 years ago
 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:= KnownUnitQ["Meters/Seconds"] Out= False In:= KnownUnitQ["Meters"/"Seconds"] Out= 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:= Quantity[1, "Meters"^E] // UnitConvert Out= UnitConvert[Quantity[1, ("Meters")^E]] In:= Quantity[1, "Meters"^E] // QuantityQ Out= False (I will confess that I'm not quite sure what you're trying to do with these however)