MathGroup Archive 2001

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

Search the Archive

Re: What is happening here? (TagSet)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27880] Re: What is happening here? (TagSet)
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 23 Mar 2001 04:31:02 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <99chu9$8eq@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

see whats happen with
Clear[u, v, x, y, z];
Clear[f, F, X, Y, U, V, Z];
UpValues /@ {u, v, x, y, z}


and


TagSet[x, Im[x], 0];
TagSet[y, Im[y], 0];
TagSet[u, Im[u[x, y]], 0];
TagSet[v, Im[v[x, y]], 0];
TagSet[x, Re[x], x];
TagSet[y, Re[y], y];
TagSet[u, Re[u[x, y]], u[x, y]];
TagSet[v, Re[v[x, y]], v[x, y]];

UpValues /@ {u, v, x, y, z}


TagSet[] ist used to associate a definition for
a function with one of the arguments and not with
the function itself.

Re[x]=0

would define a new pattern for Re[x], that fails because
Re[] is protected. You can unprotect it, and set the value
for Re[x].

Unprotect[Re]
Re[x] = 0
Protect[Re]

DownValues[Re]

But it is stored in the DownValues[] for
Re[] and every time Re[] is called this table is
used.

Re[x]^=0

set the upvalue for x and only is x is used
the up values are consulted. So the Re[] function
is not slowed down.

Regards
  Jens


> 
> Hello,
>         I've been working my way through a notebook I found on the
> Internet, and the author states the following before executing some
> commands which I don't understand:
> 
> //begin copied text
> There are two methods for defining a complex function in Mathematica.
> Before we start, make x, y, u and v real variables.
> 
> Clear[u, v, x, y, z];
> Clear[f, F, X, Y, U, V, Z];
> TagSet[x, Im[x], 0];
> TagSet[y, Im[y], 0];
> TagSet[u, Im[u[x, y]], 0];
> TagSet[v, Im[v[x, y]], 0];
> TagSet[x, Re[x], x];
> TagSet[y, Re[y], y];
> TagSet[u, Re[u[x, y]], u[x, y]];
> TagSet[v, Re[v[x, y]], v[x, y]];
> //end copied text
> 
> I of course, understand the clear statements, but I can't figure out
> what he's actually accomplishing.  I inserted statements akin to ?x,
> ?y, etc.  inbetween each instruction to see if anything was changing
> and couldn't glean any information from that, then I wrapped a few of
> the statements within a FullForm[] function call, which gave me
> something similar to this:
> //FullForm =
>         0
> which didn't help me at all.  I've looked at the documentation, the
> Wolfram Book v.4 and searched the web, all to no avail.  I can't seem
> to find what TagSet is doing.  I read through the section on
> transformations and definitions as well, but there's nothing specific
> that says TagSet[x1, x2,...xi] then explains how the arguments work
> together.
> 
> Thanks for any and all illumination,
> 
> JT


  • Prev by Date: Re: Integral problem
  • Next by Date: Re: What is happening here? (TagSet)
  • Previous by thread: Re: What is happening here? (TagSet)
  • Next by thread: Re: What is happening here? (TagSet)