Re: What variables are in a function and displaying surds
- To: mathgroup at smc.vnet.net
- Subject: [mg31135] Re: [mg31117] What variables are in a function and displaying surds
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Fri, 12 Oct 2001 03:36:55 -0400 (EDT)
- References: <200110102314.TAA25717@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
One possibility for your first question (variables are listed in the order in which they appear in the FullForm of the expression) : In[1]:= whichVariables[v_]:= Module[{a=List@@v, f}, f[u_]:=Flatten[DeleteCases[List@@#,x_?NumericQ]&/@u]; FixedPoint[f,a]] In[2]:= expr=Sin[x+y]+z/p-t; In[3]:= whichVariables[expr] Out[3]= {t,p,z,x,y} In[4]:= expr = Sin[x + Exp[y]]/Sqrt[z^(1/3)] - Cos[Sin[Tan[p]]]; In[5]:= whichVariables[expr] Out[5]= {p,z,y,x} In[6]:= expr=Sin[c[x,y]]; In[7]:= whichVariables[expr] Out[7]= {x,y} Tomas Garza Mexico City ----- Original Message ----- From: "Wonko the Sane" <michael_r_went at yahoo.com> To: mathgroup at smc.vnet.net Subject: [mg31135] [mg31117] What variables are in a function and displaying surds > Hi, > > Is there a way in Mathematica to generate a list of variables in an > expression like Variable[]. For example if I passed the expression > Sin[x+y]+ z/p - t the list {x,y,z,p,t} would be generated. > > Another unrelated question is when I use Mathematica V4.0 to calculate > tables of ThreeJSymbols the outputs Generally consist of fractions of > roots of the form > > Sqrt[a/b] , c/Sqrt[d] and Sometimes Sqrt[e/f]/g > > is there a way to force Mathematica always output them in the form > Sqrt[h]/i > > eg instead of it giving Sqrt[2/3] giving Sqrt[6]/3 > > Regards, Michael >
- References:
- What variables are in a function and displaying surds
- From: michael_r_went@yahoo.com (Wonko the Sane)
- What variables are in a function and displaying surds