MathGroup Archive 2007

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

Search the Archive

Re: search for an operator in an expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78195] Re: search for an operator in an expression
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Mon, 25 Jun 2007 07:06:43 -0400 (EDT)
  • Organization: University of Bergen
  • References: <f5iuqu$a99$1@smc.vnet.net>

Daniel wrote:
> Is there a way to search for an operator in a symbolic expression? My wish is to show that there is only "+" in a very large expression. Rather than showing an expression on multiple pages I would like to perform a search that shows there is only "+" between the terms. Converting to a string does not seem to work since the expression is written on multiple lines(fractions, exponents etc..)
> 
> Thanks
> 

If you have Mathematica <= 5.2, read the first few chapters from 
Principles of Mathematica in the Mathematica book to understand how 
expressions are represented (and how they can be manipulated).

For Mathematica 6.0,
http://reference.wolfram.com/mathematica/guide/Expressions.html
is a good starting point.

Use FullForm to see how expressions are represented.

FreeQ[expr, Plus] tells you if there are any additions in the 
expression.  I am sure that you want to do something more complicated 
than this, but I cannot answer your question unless you formulate it 
more precisely, and give some examples.  If there are fractions in the 
expression, then clearly addition is not the only operation: there is 
also division, etc.

Szabolcs



  • Prev by Date: CountryData "UnitedStates" "GovernmentSurplus" problem
  • Next by Date: Why use Java in Mathematica?
  • Previous by thread: Re: search for an operator in an expression
  • Next by thread: Re: search for an operator in an expression