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

MathGroup Archive 1997

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

Search the Archive

Re: Replace expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7691] Re: Replace expressions
  • From: Vanessa Portioli Rolnik <vanessa at icmsc.sc.usp.br>
  • Date: Sun, 29 Jun 1997 22:17:26 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello all,

I have expressions of the type:
  
              test=u[i,{1,j},{2,k},t] 

and I want to perform the following replacements:
              i->0,t->0,{1,j}->1*j and {2,k}->2*k
to get 
              u[0,j,2k,0]

I use the following command 

              test/.{{a_Integer,b_Symbol}->a*b,c_Symbol->0}

but I the result is

              0[0, 0[1, 0], 0[2, 0], 0]

instead of what I expected it to be:
	      u[0,j,2k,0]

I need a command to hold the head of the expression and the lists, or a
better way to perform this replacement.
  
Please answer by email to vanessa at icmsc.sc.usp.br. If there is enough
interest, I will post the answers to the net.

Thanks in advance for any help,
 
Vanessa






  • Prev by Date: Lighting
  • Next by Date: problem of notebook in 16bit X server
  • Previous by thread: Re: Replace expressions
  • Next by thread: Re: Replace expressions