Re:Extracting units from a list of values
- To: mathgroup at smc.vnet.net
- Subject: [mg27430] Re:Extracting units from a list of values
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Sun, 25 Feb 2001 20:55:34 -0500 (EST)
- Organization: The Math Forum
- References: <avsmaaxiped4@forum.mathforum.com>
- Sender: owner-wri-mathgroup at wolfram.com
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