MathGroup Archive 1996

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

Search the Archive

Re: substitution rules and patterns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3428] Re: [mg3410] substitution rules and patterns
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Wed, 6 Mar 1996 01:47:51 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

Susan Rempe <rempe at euclid.chem.washington.edu>
[mg3410] substitution rules and patterns
Asks
>Could someone tell me why the first substitution rule
>works and the second doesn't----
>
>In[70]:= (c^2)^(d/2)/.{(a_^2)^(b_ /2)->a^b}
>Out[70]= c^d
>
>In[71]:= (c^2)^(5/2)/.{(a_^2)^(b_ /2)->a^b}
>Out[71]= (c^2)^(5/2)


Susan:

Mathematica sees the full forms:

(*1*) (c^2)^(d/2)//FullForm
	Power[Power[c, 2], Times[Rational[1, 2], d]]

(*2*) (c^2)^(5/2)//FullForm
	Power[Power[c, 2], Rational[5, 2]]

The left side of your rule (a_^2)^(b_ /2)->a^b has FullForm

(a_^2)^(b_ /2)//FullForm
	Power[Power[Pattern[a, Blank[]], 2],
 		Times[Rational[1, 2], Pattern[b, Blank[]]]]

which matches (*1*) but not (*2*)

Allan Hayes
hay at haystack.demon.co.uk




==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: substitution rules and patterns
  • Next by Date: FindRoot output format
  • Previous by thread: Re: substitution rules and patterns
  • Next by thread: Re: substitution rules and patterns