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

MathGroup Archive 2004

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

Search the Archive

RE: How to substitute?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45489] RE: [mg45474] How to substitute?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Sat, 10 Jan 2004 00:00:36 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Steve,

expr = (Subscript[y, 0] - Subscript[z, 3])*
   (-Subscript[y, 1] + Subscript[z, 3])*
   (-Subscript[y, 2] + Subscript[z, 3])*
   (-Subscript[y, 3] + Subscript[z, 3])

expr //. {Subscript[y, i_] - Subscript[z, j_] ->
    Q[i, j], -Subscript[y, i_] + Subscript[z, j_] ->
    -Q[i, j]}
-Q[0, 3] Q[1, 3] Q[2, 3] Q[3, 3]

(I used Bobby Treat's neat copy palette to copy and paste these
expressions.)

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/




From: Steve Gray [mailto:stevebg at adelphia.net]
To: mathgroup at smc.vnet.net


\!\(\((y\_0 - z\_3)\)\ \((\(-y\_1\) + z\_3)\)\ \((\(-y\_2\) +
        z\_3)\)\ \((\(-y\_3\) + z\_3)\)\)

	I have output cells containing various expressions such as
(y[0]-z[1]) (y[1]-z[2]) (y[4] - z[0]), where I use [x] here to mean
subscript. The integers can have any small values. For compactness of
expression, I want to make substitutions which make the above
expression look like Q[0,1]Q[1,2]Q[4,0]. There are many combinations
of subscript pairs and I don't want to write explicit substitution
rules for every possible combination. I tried doing /.(y[i]-z[j]) ->
Q[i,j] , and /.(y[i_]-z[j_]) -> Q[i,j] but they don't work.
	Any suggestions will be gratefully received.



  • Prev by Date: Re: How to substitute?
  • Next by Date: complicated vector-valued function
  • Previous by thread: Re: How to substitute?
  • Next by thread: Re: How to substitute?