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:= nrad = Quantity[1, "Meters"]; m1 = Quantity[1, "Kilograms"]; m2 = Quantity[1, "Kilograms"]; g = Quantity[1, "GravitationalConstant"]; In:= (g m1 m2)/nrad^2 Out= 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:= ?Gravita* GravitationalConstant is the coefficient of proportionality in Newton's law of gravitation. In:= GravitationalConstant//N -11 2 6.67266 10 Meter Newton Out= --------------------------- 2 Kilogram In:= m1=1 Kilogram Out= Kilogram In:= m2=1 Kilogram Out= Kilogram In:= g=GravitationalConstant; In:= nrad=1 Meter Out= Meter In:= (g m1 m2)/nrad^2 Out= 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 *) Answer
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 Answer
Anonymous User
Anonymous User
Posted 3 years ago
 In:= % // UnitConvert Out= Quantity[6.674*10^-11, ("Kilograms" "Meters")/("Seconds")^2] In:= % // UnitSimplify Out= 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. Answer