Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Q: Why can't I stop TraditionalForm dismissing Times Attributes ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15736] Q: Why can't I stop TraditionalForm dismissing Times Attributes ?
  • From: Fabien Boniver <F.Boniver at ulg.ac.be>
  • Date: Fri, 5 Feb 1999 03:42:30 -0500 (EST)
  • Organization: Université de Liège
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

This message ends with the shortest transcript I can get  of a session
explaining
my problem.
This is about two bizarre side-effects of TraditionalForm. Maybe  they
are due to some (numerous 8-) ) lacks in my Mathematica knowledge.

In order to do some formal computations, I need Plus and Times not to be

Listable.  See the myPlusTimes function below. TraditionalForm seems to
rely on the fact that Times is Listable (that would be another
transcript 8-) ) and it actually modifies the Listable property of
Times, which in turn leads to amazing results.

So, I decided to try to be clear and precise (see function mathPlusTimes

and myTraditionalForm below).
And now, Mathematica does not do the same thing on two consecutive
evaluations of the same computation (see In[7] and In[9]), though I
don't attempt to affect any symbol value.

I use Mathematica 3.0.1.1x on a PMAC 604e running MacOs 8.1.

Hope somebody can explain.
Many thanks in advance,

Fabien

*** CUT TRANSCRIPT HERE
In[1]:=
Attributes[{Plus,Times}]
Out[1]=
{{Flat,Listable,NumericFunction,OneIdentity,Orderless,Protected},{Flat,
Listable,NumericFunction,OneIdentity,Orderless,Protected}}

In[2]:=
mathPlusTimes[dummy_]:=Module[{},Unprotect[Plus,Times];
SetAttributes[Plus,Listable];
SetAttributes[Times,Listable];
Protect[Plus,Times];
dummy
]

In[3]:=
myPlusTimes[dummy_]:=Module[{},Unprotect[Plus,Times];
ClearAttributes[Plus,Listable];
ClearAttributes[Times,Listable];
Protect[Plus,Times];
dummy
]

In[4]:=
myTraditionalForm[x_]:=myPlusTimes[TraditionalForm[mathPlusTimes[x]]]

In[5]:=
myPlusTimes[1];

In[6]:=
Attributes[{Plus,Times}]
Out[6]=
{{Flat,NumericFunction,OneIdentity,Orderless,Protected},{Flat,NumericFunction,

OneIdentity,Orderless,Protected}}

In[7]:=
1//myTraditionalForm
Attributes[{Plus,Times}]
Out[7]//TraditionalForm=
1
Out[8]=
{{Flat,NumericFunction,OneIdentity,Orderless,Protected},{Flat,Listable,
NumericFunction,OneIdentity,Orderless,Protected}}

In[9]:=
1//myTraditionalForm
Attributes[{Plus, Times}]
Out[9]//TraditionalForm=
1
Out[10]=
{{Flat,NumericFunction,OneIdentity,Orderless,Protected},{Flat,NumericFunction,

OneIdentity,Orderless,Protected}}

*** END OF TRANSCRIPT


--
Fabien BONIVER

Inst. of Math., University of Liege
**
Universite de Liege
Service de Geometrie et Theorie des Algorithmes Institut de
Mathematique, B37
Grande Traverse, 12
4000 Sart Tilman (Liege),  Belgium
**
Email : F.Boniver at ulg.ac.be
Phone : + 32 4 366 94 17



  • Prev by Date: RE:Help to clarify 'Map', 'Apply', and 'Thread'.
  • Next by Date: Re: Transc. Eqn - Symb. Iterative Sol'n.?
  • Previous by thread: Re: speed
  • Next by thread: Re: Q: Why can't I stop TraditionalForm dismissing Times Attributes ?