MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re:Extracting units from a list of values


My earlier post  does not transform integers>1 at level 1 in the list.
The following seems to be more general and does the required task

In[104]:=mylist2 = {3, 2*Pi, 3*E*Meter^2, (3.5*Meter^2)/s, Meter*Pi,
3/(Pi*s), 3.75,  Sqrt[3]/Sqrt[7]}

In[136]:=mylist3 = DeleteCases[(If[NumericQ[#1], 1, #1] & ) /@
mylist2, _?NumericQ, {2}]

Out[136]={1, 1, Meter^2, Meter^2/s, Meter, 1/s, 1, 1}

and then a list of the numerical values is

In[137]:=mylist2/mylist3

Out[137]={3, 2*Pi, 3*E, 3.5, Pi, 3/Pi, 3.75, Sqrt[3/7]}.


Brian


  • Prev by Date: Re: Summation without Mathematica
  • Next by Date: Re: Deriviation d/dt(x(t))
  • Previous by thread: RE: Extracting units from a list of values
  • Next by thread: Hydrodybnamics of liquid and gas