MathGroup Archive 1991

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

Search the Archive

Re: Extracting variables nested in functions

  • To: MathGroup at yoda.physics.unc.edu
  • Subject: Re: Extracting variables nested in functions
  • From: David Withoff <withoff>
  • Date: Tue, 15 Oct 1991 09:04:46 -0500

The Level function gives subexpressions in an expression:

In[86]:= Level[Log[b[1], x[1]], -1]

                                      1
Out[86]= {1, b[1], Log[b[1]], -1, ---------, 1, x[1], Log[x[1]]}
                                  Log[b[1]]

Variables can then be selected using appropriate criteria:

In[87]:= v = Select[%, !NumberQ[#] &]

                               1
Out[87]= {b[1], Log[b[1]], ---------, x[1], Log[x[1]]}
                           Log[b[1]]

In[88]:= VarQ[e_] := And @@ Map[e===# || FreeQ[e, #] &, v]

In[89]:= Select[v, VarQ]

Out[89]= {b[1], x[1]}




  • Prev by Date: Question about x_h
  • Next by Date: CABRI?
  • Previous by thread: Re: Extracting variables nested in functions
  • Next by thread: Re: Extracting variables nested in functions