Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Unit conversion of a list of quantities
Replies: 4   Last Post: Nov 8, 2013 4:05 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Bob Hanlon

Posts: 891
Registered: 10/29/11
Re: Unit conversion of a list of quantities
Posted: Nov 8, 2013 3:55 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Convert your lists to quantities before using UnitConvert


Edep = {4.9491200000000017`*^-14 Joules, 1.8669264000000004`*^-14 Joules,
6.223088000000001`*^-15 Joules};


mass = {0.043937500000000004` g, 0.06987` g, 0.02329` g};


dose = UnitConvert[Quantity[Edep/Joules, "Joules"]/
Quantity[mass/g, "Gram"], "Joules/kg"]


{Quantity[
1.1264000000000004*^-9,
"Joules"/"Kilograms"],
Quantity[
2.6720000000000007*^-10,
"Joules"/"Kilograms"],
Quantity[2.672*^-10,
"Joules"/"Kilograms"]}


This can be shortened


dose = UnitConvert[Quantity[Edep/Joules, "J"]/
Quantity[mass/g, "g"], "J/kg"]


{Quantity[
1.1264000000000004*^-9,
"Joules"/"Kilograms"],
Quantity[
2.6720000000000007*^-10,
"Joules"/"Kilograms"],
Quantity[2.672*^-10,
"Joules"/"Kilograms"]}


% == %%


True



Bob Hanlon




On Thu, Nov 7, 2013 at 12:28 AM, mariusz sapinski <
mariusz.sapinski@gmail.com> wrote:

> I have the following lists:
> Edep = {4.9491200000000017`*^-14 Joules,
> 1.8669264000000004`*^-14 Joules, 6.223088000000001`*^-15 Joules}
> mass = {0.043937500000000004` g, 0.06987` g, 0.02329` g}
>
> I want to calculate dose:
> dose = Edep/mass
>
> I get another list (of Quantities):
>
> {(1.1264*10^-12 Joules)/g, (2.672*10^-13 Joules)/g, (
> 2.672*10^-13 Joules)/g}
>
> OK, but I want to have Grays, ie. Joules/kg:
>
> UnitConvert[dose, "Joules/kg"]
>
> Unfortunately output is not what I want:
> {UnitConvert[(1.1264*10^-12 Joules)/g, "Joules/kg"],
> UnitConvert[(2.672*10^-13 Joules)/g, "Joules/kg"],
> UnitConvert[(2.672*10^-13 Joules)/g, "Joules/kg"]}
>
>
> How to get Mathematica to convert J/g to J/kg?
> Mathematica 9.0.1 on linux.
>
> Regards, Mariusz
>
>






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.