Re: Times Ordered Bug with trig functions??

• To: mathgroup at smc.vnet.net
• Subject: [mg29612] Re: [mg29598] Times Ordered Bug with trig functions??
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Thu, 28 Jun 2001 05:28:02 -0400 (EDT)
• References: <200106270912.FAA04071@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Alan Mason wrote:
>
> Hello.
> I've succeeded in writing a differential operator calculus program using **
> (NonCommutativeMultiply).
> However, my first choice was to set Times to Ordered by
> ClearAttributes[Times, {Orderless}].  This seemed preferable since no change
> of notation is involved. In so doing I discovered an apparent bug -- with
> trig functions (but not others) a wrong answer results; something in the
> Trig module is causing the system to forget that Times is supposed to be
> Ordered. Probably an unwholesome interaction with Power, since the error
> occurs when powers would be available with the normal Times.
>
> The following code exhibits the problem (all symbols are global atoms):
> In[1]:=
> ClearAttributes[Times, {Orderless}]
> In[2]:=
> a c D a b e
> Out[2]=
> a c D a b e
> In[3]:=
> a c Cos[q] D v Cos[q] (* WRONG *)
> Out[3]=
> \!\(a\ c\ D\ v\ Cos[q]\^2\)
> In[4]:=
> a c Cos[q] D V Cos[w]
> Out[4]=
> a c Cos[q] D V Cos[w]
> In[5]:=
> a c Exp[q] D v Exp[q]
> Out[5]=
> \!\(a\ c\ E\^q\ D\ v\ E\^q\)
> In[6]:=
> a c Tan[x] D v Tan[x] (* WRONG *)
> Out[6]=
> \!\(a\ c\ D\ v\ Tan[x]\^2\)
>
> I spoke to support at Wolfram Research, but they deny this is a bug.  Seems
> to me it at the very least breaks the pattern matcher.  I'm running
> Mathematica 3.0; perhaps Times Ordered will not be supported in the future.
> Fortunately, there are other (more complicated) ways to get the desired
> effect.

This topic of making Times Orderless comes up from time to time in this
group. Below are some URLs to previous discussions along these lines.

http://library.wolfram.com/mathgroup/archive/1998/Jul/msg00090.html
http://library.wolfram.com/mathgroup/archive/1998/Jul/msg00256.html
http://library.wolfram.com/mathgroup/archive/1998/Jul/msg00288.html

http://library.wolfram.com/mathgroup/archive/2001/Jan/msg00293.html
http://library.wolfram.com/mathgroup/archive/2001/Jan/msg00385.html
http://library.wolfram.com/mathgroup/archive/2001/Jan/msg00430.html

There is a known issue (I myself no longer regard it as a bug) wherein
Orderless Times gets messed up by Power. It is discussed in some of the
notes above. That said, I'd not hold my breath waiting for this behavior
to change. Using NoncommutativeMultiply is a good way to proceed, and we
do not intend to support fundamental changes to Times for this purpose.

If it is of any use, the issue of implementing differential operators
has also arisen a few times. The note below, and others in that thread,
cover the topic in some detail.

http://library.wolfram.com/mathgroup/archive/1999/Mar/msg00612.html

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: RE: Frame on Bar Chart
• Next by Date: Program crash
• Previous by thread: Times Ordered Bug with trig functions??
• Next by thread: Frame on Bar Chart