MathGroup Archive 2001

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

Search the Archive

Re: 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.

hmm... what may 

Cases[Sin[x + y] + z/p - t, _Symbol, Infinity]

do ?

> 
> 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


No, since Sqrt[6]/3 is automatical simplifyed to Sqrt[2/3]
Just look what

Trace[Sqrt[2/3] /. 
    Sqrt[a_] :> Sqrt[Numerator[a]*Denominator[a]]/Denominator[a]]

does. The only way to prevent this is to make a new Sqrt[] function,
i.e. mySqrt[]
and

In[]:=Sqrt[2/3] /. Sqrt[a_] :>
mySqrt[Numerator[a]*Denominator[a]]/Denominator[a]

Out[]=mySqrt[6]/3

Regards
  Jens


  • Prev by Date: FindMinimum
  • Next by Date: Re: Newbie Plot-Fit Questions.
  • Previous by thread: Re: What variables are in a function and displaying surds
  • Next by thread: Newbie Plot-Fit Questions.