Anonymous User

# New Quantity func doesn't simplify and Constants hide value? How do I use?

Anonymous User
Posted 3 years ago
3035 Views
|
2 Replies
|
3 Total Likes
|
 Dear Mr newton, I'm lacking Newton in my Out, why doesn't this Simply? I read "Units Overview" didn't see anything relevant I knew how to work with this in Mathematica 4.0 (and 4.0's pitfalls), I thought 11.x was simpler until I ran into this (in 11.x): In[xxx]:=? GravitationalConstant; ?G Out[xxx]= (not defined, no info) (in addition, Documentation/Help does not show it's use or definition either) In[14]:= nrad = Quantity[1, "Meters"]; m1 = Quantity[1, "Kilograms"]; m2 = Quantity[1, "Kilograms"]; g = Quantity[1, "GravitationalConstant"]; In[16]:= (g m1 m2)/nrad^2 Out[16]= 1(kg)^2G/(m)^2 (note G is 11.x's representation of GravConst and expression was not simplified, ditto for kg(kilogram) and m(meter))So obviously if I don't know the "digital value" of GravitationalConstant, I'll have to enter it by hand? And I have to do unit cancelation by hand? If that is true, then 11.x's rendition of Units - well let's say I see only dis-advantages?This is from Mathematica 4.0 (note there were issues with how this worked (Convert or Simplify of) for some units, 4.0 "was improved for legitimate reasons"). However as you see below for many uses it was convenient. It also shows "what i'm expecting" (automatic cancelation of units and fitting of resulting units to single unit; here Newton is right).  In[2]:= ?Gravita* GravitationalConstant is the coefficient of proportionality in Newton's law of gravitation. In[3]:= GravitationalConstant//N -11 2 6.67266 10 Meter Newton Out[3]= --------------------------- 2 Kilogram In[4]:= m1=1 Kilogram Out[4]= Kilogram In[5]:= m2=1 Kilogram Out[5]= Kilogram In[6]:= g=GravitationalConstant; In[7]:= nrad=1 Meter Out[7]= Meter In[8]:= (g m1 m2)/nrad^2 Out[8]= 6.67266 10^-11 Newton From what I remember the excuse for "disrupting" all past notebooks (which must be upgrade by each writer) to "improve units" was that 4.0's units didn't always Simplify properly (depending on the kind of unit). But is the new feature "being unable to cancel units at all"? If so that's a feature removed not added.Quantity[1.84, ("Meters""Pascals")/"Farads"] ( this new syntax is just terrible and not usable with math as we see in books - it's more like something you might see used in a C source code solution - not 2nd gen software per say, it's a reversion back to 1st gen coding *)
2 Replies
Sort By:
Posted 3 years ago
 In Mathematica 11.3 version:  R = Quantity[1, "Meters"]; m1 = Quantity[1, "Kilograms"]; m2 = Quantity[1, "Kilograms"]; G = Quantity[1, "GravitationalConstant"]; (G*m1*m2)/R^2 // UnitConvert Or:  (G*m1*m2)/R^2 // UnitSimplify 
 In[4]:= % // UnitConvert Out[4]= Quantity[6.674*10^-11, ("Kilograms" "Meters")/("Seconds")^2] In[5]:= % // UnitSimplify Out[5]= Quantity[6.674*10^-11, "Newtons"] Thank you. i didn't even check UnitConvert because it's not a conversion (not what Convert[] did in 4.0 either). UnitSimplify[] was not in the See Also of help for Quantity[]. The overview didn't mention UnitSimplify (but I did miss finding the Unit guide page).I really don't like the "1st generation" oob style solution, but at least it can be made to work.