MathGroup Archive 1997

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

Search the Archive

Effect of TagSet

  • To: mathgroup at
  • Subject: [mg8620] Effect of TagSet
  • From: seanross at
  • Date: Fri, 12 Sep 1997 04:10:35 -0400
  • Sender: owner-wri-mathgroup at

> > The simplest way to deal with this is to declare
> >
> > p/:Im[p]=0
> >
> > Then, f[x, p] will give you an answer (if Arg[x^2]!=\[Pi]).
> >
> > -------
> >                             Raya Khanin
The construct 


Is called TagSet and is associated with "Upvalues" which seem to be
transformation rules associated with symbols, sort of like a custom
"Head".  I am having trouble understanding what real effect setting them
has on the way expressions are evaluated.  Take, for example, the 

Integral[Exp[- Pi r^2/w^2,{r,-Infinity,Infinity}].  

Mathematica returns:

If[Re[w^2]>0, Sqrt[w^2]/2,
Integral[Exp[- Pi r^2/w^2,{r,-Infinity,Infinity}]], 

indicating that it doesn't know what to do with the integral if w is
complex.  It would be lovely to "declare" w to be real and the post
above makes it sort of sound like    w/:Im[w]=0   would do just that. 
However, the assignment of the "Upvalue" makes no difference in the
output returned by Integrate in this case, so I am left still wondering
of what practical use are these "Upvalues".  

Can anyone show a simple example in which the assignment of an Upvalue
(or DownValue) changes the way a subsequent expression is evaluated? 
Please note I don't care about the integral example, I only used it as a
case in point.

  • Prev by Date: More: tantamount error messages when interupting
  • Next by Date: Re: MatchQ
  • Previous by thread: Re: More: tantamount error messages when interupting
  • Next by thread: loess regression