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: [mg114599] Re: Replacement Rule with Sqrt in denominator
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Fri, 10 Dec 2010 02:27:59 -0500 (EST)
  • References: <idnqpr$q58$1@smc.vnet.net> <idqd1i$j3o$1@smc.vnet.net>

Hi,

> I don't want to claim that pattern matching in Mathematica is bugged,
> I am certainly not entitled to do so. I was always quite happy to
> follow the rules and look at the FullForm in order to create the
> correct pattern, until I learned (actually just by following this
> thread) that this does not always produce the expected results. So
> even though this may not be a bug, pattern matching can be very
> confusing sometimes, and, in terms of usability, may seem to be poorly
> implemented to some people.

> Having said that, could somebody give me a little insight on how
> pattern matching "really" works (I'm sure Daniel has done so many
> times already, please feel free to refer me to previous posts!):
> What set (or class) of expressions does pattern matching exclude from
> its "normal" behavior (obviously there is Rational, Complex,
> whatnot...)? Why? Are there different such classes? Why does 3/5[[1]]
> fail (alternatively: Why does Rational behave differently then List,
> say)?

I think the reason is that Rational, Complex, SparseArray and some
others are atoms, which you can check by AtomQ (see also
tutorial/BasicObjects). Unfortunately there seems to be no
"PatternMatcherForm" which would allow users to look at the expression
as the pattern matcher actually sees it. Also I can see no obvious and
consistent pattern on what is treated as an atom and what not: while
SparseArray-objects are atoms (tested with AtomQ and even documented as
such) InterpolatingFunction-objects are not...

hth,

albert


  • Prev by Date: Re: Replacement Rule with Sqrt in denominator
  • Next by Date: Re: Solving matrix equations
  • Previous by thread: Re: Replacement Rule with Sqrt in denominator
  • Next by thread: Re: Replacement Rule with Sqrt in denominator