Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

ReplaceRepeated info

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77673] ReplaceRepeated info
  • From: "alexxx.magni at gmail.com" <alexxx.magni at gmail.com>
  • Date: Thu, 14 Jun 2007 06:19:30 -0400 (EDT)

Hi everybody,
I need to use in my program ReplaceRepeated, and also to know, after
it has been applied, how many times a replacement happened. Say, after
this:

 Log[d p q r] Log[a b c d]//.Log[x_ y_] ->Log[x] + Log[y]

(Log[a] + Log[b] + Log[c] + Log[d]) (Log[d] + Log[p] + Log[q] +
Log[r])


... I'd need to know that it performed 6 substitutions.
There is a way with //. , or have I to resort to some loop around /. ,
checking myself when no change happens anymore?


Thank you!

Alessandro Magni



  • Prev by Date: default display of reals & last command behavior in terminal
  • Next by Date: Re: Integrate question
  • Previous by thread: Re: default display of reals & last command behavior in terminal
  • Next by thread: Re: ReplaceRepeated info