Re: Replacement Rule with Sqrt in denominator. Also Bug in Series; see Semantica / Harris solution

*To*: mathgroup at smc.vnet.net*Subject*: [mg114663] Re: Replacement Rule with Sqrt in denominator. Also Bug in Series; see Semantica / Harris solution*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Sun, 12 Dec 2010 05:42:31 -0500 (EST)

----- Original Message ----- > From: "Richard Fateman" <fateman at cs.berkeley.edu> > To: mathgroup at smc.vnet.net > Sent: Saturday, December 11, 2010 12:54:08 AM > Subject: [mg114638] Re: Replacement Rule with Sqrt in denominator. Also Bug in Series; see Semantica / Harris solution > I just came across this, from a link in this newsgroup, 10 years ago > or so. > Jason Harris wrote a package called "Semantica" for pattern matching. > It rewrites ReplaceAll etc etc etc, and adds a functionality by > producing new rules if the LHS includes "Semantic" parts. Thus > > > f[8] /. f[Semantic[2*x_]] -> g[x] > > returns g[4]. > > f[3+4 I] /. f[Semantic[a_+b_ I] -> aha[a,b] > > returns aha[3,4] > > .. actually, it doesn't quite do that in version 7.0, but > it almost does. I don't know if the bug would be exhibited in > the version of Mathematica current in 1999. It seems to involve > a disagreement about dynamic binding. > > Harris' code requires the use of Solve when defining rules, > but often need not use Solve when applying them. > > See > http://www.mathematica-journal.com/issue/v7i3/features/harris/ > > For your information, the first of the rules above, > f[Semantic[2*x_]]->g[x] > is converted to > {HoldPattern[f[L$10_]] :> With[{x = L$10/2}, g[x] /; True]} > > > There are various limitations in the rule transformations, like only > single-underscore variables are allowed. > > Actually, it doesn't handle the rule Sqrt[x] -> g. > > but maybe that could be added. Perhaps it could become > x^(r_) :> With[{L = 2*r}, g^L /; Denominator[r] == 2] > > Harris' code looks fairly complicated, but can be downloaded free. > Not like the paper, which appeared in the "Mathematica Journal". > > I guess Jason Harris is doing something else now. > > RJF The paper can be downloaded for free. Click the "Download this Article as a Mathematica Notebook" link. The parenthesized part in red, that says (Subscribers Only) should be ignored (show it you mean business). The journal is now freely available, and many back issues are likewise now free. I'll point out to someone that the "subscribers only" is still lingering. The link below will say a bit about what Jason Harris is up to of late. http://www.eng.monash.edu.au/eco/showevent.php?year09&eid=214 For my part, I was ecstatic to see what some of the recent work achieved. Daniel Lichtblau Wolfram Research