MathGroup Archive 1997

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

Search the Archive

Re: About patterns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9820] Re: [mg9713] About patterns
  • From: BobHanlon at aol.com
  • Date: Fri, 28 Nov 1997 05:35:35 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Here are two substitution rules depending on whether you want separate
replacements.  The parameter in the substitution definition enables you
to expand the number of substitution rules.

Bob Hanlon

___________________________________

substA[m_Integer] := 
			(ToExpression["R" <> ToString[#]] *  ToExpression["C" <> ToString[#]]

            x___:> A *x) & /@ Range[m]

subAn[m_Integer] := 
			(ToExpression["R" <> ToString[#]] *  ToExpression["C" <> ToString[#]]

            x___:> 
			ToExpression["A" <> ToString[#]] *x) & /@ Range[m]

R1*R2*C1*C2 //. substA[2]

\!\(A\^2\)

R1*R2*R3*C1*C2*C3 //. substA[3]

\!\(A\^3\)

R1*R2*C1*C2 //. subAn[2]

A1 A2

R1*R2*R3*C1*C2*C3 //. subAn[3]

A1 A2 A3



  • Prev by Date: Coloring Surfaces
  • Next by Date: Kronecker Delta
  • Previous by thread: About patterns
  • Next by thread: Re: About patterns