Re: Replacement Rule with Sqrt in denominator. Also Bug in Series; see Semantica / Harris solution
- To: mathgroup at smc.vnet.net
- Subject: [mg114673] Re: Replacement Rule with Sqrt in denominator. Also Bug in Series; see Semantica / Harris solution
- From: Yves Klett <yves.klett at googlemail.com>
- Date: Sun, 12 Dec 2010 05:46:18 -0500 (EST)
> Harris' code looks fairly complicated, but can be downloaded free. > Not like the paper, which appeared in the "Mathematica Journal". My last info was that the Mathematica Journal is now availabe for free. Download away. Yves Am 11.12.2010 07:54, schrieb Richard Fateman: > 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 > > >