Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Replacement Rule with Sqrt in denominator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114440] Re: Replacement Rule with Sqrt in denominator
  • From: Roland Franzius <roland.franzius at uos.de>
  • Date: Sat, 4 Dec 2010 06:15:17 -0500 (EST)
  • References: <ic5igm$44p$1@smc.vnet.net> <ic8ad7$81f$1@smc.vnet.net> <id7t95$lh1$1@smc.vnet.net> <idagbn$js7$1@smc.vnet.net>

Am 03.12.2010 11:21, schrieb Richard Fateman:
> On 12/2/2010 2:43 AM, Roland Franzius wrote:
> ....
>
>>
>> Use rules like
>>
>> HoldPattern[x^Rational[a_,2]] :>    G^a
>>
>> eg this works for contraction of products of fractional powers
>>
>> ((1 + I x)^(1/2)/(1 - I x)^(1/2)) /.
>> 	{HoldPattern[a_^Rational[b_, c_] d_^Rational[e_, c_]]
>> 		:>   (a^b d^e)^(1/c)}
>
> Not really. Consider the very similar example
>
> ((1 + I x)^(a/2)/(1 - I x)^(a/2)) /. {HoldPattern[
>       a_^Rational[b_, c_] d_^Rational[e_, c_]] :>  (a^b d^e)^(1/c)}
>
> where we have a/2 instead of 1/2
>
> and the pattern does not match.  Maybe you don't want it to match in
> this case, but the problem persists even if you do. Like this pattern:
>
> ((1 + I x)^(a/2)/(1 - I x)^(a/2)) /. {HoldPattern[
>       a_^(b_/c_) d_^(e_/c_)] :>  (a^b d^e)^(1/c)}
>
> which fails.

It seems you have not yet recognized that pattern matching in 
Mathematica fails by construction if the symbol name of pattern, here a_ 
concides  with a symbol in the expression.

The rest of these kind of problems - different typisation of numbers and 
expressions, real number rules failing in complex cases, comlex 
multivaluedness in fractional powers logarithms and contour integrals, 
pattern evaluation precedence and rule noncommutativity of rule 
application in real time and many different problems of this kind are 
deeply knitted into the design of a pattern replacement language like 
Mathematica.

So the alternatives are to write an alternative language or to learn 
mastering the of use it. The same alternative holds for all of 
mathematics.

-- 

Roland Franzius


  • Prev by Date: Re: Replacement Rule with Sqrt in denominator
  • Next by Date: Re: [Please Help] How to get coefficient list from a
  • Previous by thread: Re: Replacement Rule with Sqrt in denominator
  • Next by thread: Re: Replacement Rule with Sqrt in denominator