Skip to main content
deleted 10 characters in body
Source Link
Mr.Wizard
  • 273.1k
  • 34
  • 595
  • 1.4k

This is a kludge, but maybe it can be improved upon.

cgRule = {"Meters"-> Quantity[100, "Centimeters"], "Kilograms" -> Quantity[1000,"Grams"], "Seconds" -> Quantity[1,"Seconds"]};

cgF = QuantityUnit[#] QuantityMagnitude[#]/.cgRule &;

(*Then *)

cgRule = {"Meters"-> Quantity[100, "Centimeters"],
  "Kilograms" -> Quantity[1000,"Grams"], "Seconds" -> Quantity[1,"Seconds"]};

cgF = QuantityUnit[#] QuantityMagnitude[#] /. cgRule &;

In[37]Then:= UnitConvert[Quantity[1,"erg"] ]//cgF//InputForm

Out[37]//InputForm= Quantity[1, ("Centimeters"^2*"Grams")/ "Seconds"^2]

UnitConvert[Quantity[1,"erg"] ] // cgF // InputForm
Quantity[1, ("Centimeters"^2*"Grams")/"Seconds"^2]

This is a kludge, but maybe it can be improved upon.

cgRule = {"Meters"-> Quantity[100, "Centimeters"], "Kilograms" -> Quantity[1000,"Grams"], "Seconds" -> Quantity[1,"Seconds"]};

cgF = QuantityUnit[#] QuantityMagnitude[#]/.cgRule &;

(*Then *)

In[37]:= UnitConvert[Quantity[1,"erg"] ]//cgF//InputForm

Out[37]//InputForm= Quantity[1, ("Centimeters"^2*"Grams")/ "Seconds"^2]

This is a kludge, but maybe it can be improved upon.

cgRule = {"Meters"-> Quantity[100, "Centimeters"],
  "Kilograms" -> Quantity[1000,"Grams"], "Seconds" -> Quantity[1,"Seconds"]};

cgF = QuantityUnit[#] QuantityMagnitude[#] /. cgRule &;

Then:

UnitConvert[Quantity[1,"erg"] ] // cgF // InputForm
Quantity[1, ("Centimeters"^2*"Grams")/"Seconds"^2]
Source Link
Bob R
  • 135
  • 7

This is a kludge, but maybe it can be improved upon.

cgRule = {"Meters"-> Quantity[100, "Centimeters"], "Kilograms" -> Quantity[1000,"Grams"], "Seconds" -> Quantity[1,"Seconds"]};

cgF = QuantityUnit[#] QuantityMagnitude[#]/.cgRule &;

(*Then *)

In[37]:= UnitConvert[Quantity[1,"erg"] ]//cgF//InputForm

Out[37]//InputForm= Quantity[1, ("Centimeters"^2*"Grams")/ "Seconds"^2]