Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*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 1996

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

Search the Archive

Re: Thanks for Rearrangement & Format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg5485] Re: [mg5438] Thanks for Rearrangement & Format
  • From: Daniel Lichtblau <danl>
  • Date: Wed, 11 Dec 1996 03:16:03 -0500
  • Organization: wolfram.com
  • Sender: owner-wri-mathgroup at wolfram.com

Susan Rempe wrote:
> 
> Thanks to all who responded to my 2 questions.
> The answers I liked best are the following:
> 
> 1).  To replace a term in a function without
>      letting rearrangement occur, clear the
>      attributes of the operator(s) and make
>      orderless.  Explicitly order terms with Sort.
> 
>       In[195]:= t=a+b+c+d;
>       In[196]:= ClearAttributes[Plus,Orderless]
>       In[197]:= t[[3]]=x
>       In[198]:= t
>       Out[198]= a + b + x + d
>       In[199]:= Sort[%]
>       Out[199]= a + b + d + x
> 
>...
> Susan Rempe

I'd recommend heavily against this method. What you want to do, it
appears, is reformat the expression. This can be done by a mix of
formatting rules and application of some dummy head e.g. ncPlus to your
expression (to replace the head Plus). The method you posted uses a very
dangerous tool, removal of Orderless attribute from Plus, to solve a
problem that is unrelated to the mathematics of a noncommutative
addition operator. Moreover, I very much doubt that the internals of
Mathematica will work correctly with such an operator. Which is what you
have, once that Orderless attribute has been cleared.

Daniel Lichtblau
Wolfram Research
danl at wolfram.com


  • Prev by Date: Re: Thanks for Rearrangement & Format
  • Next by Date: Re: How can I use different symbols to reperesent my 2D data?
  • Previous by thread: Re: Thanks for Rearrangement & Format
  • Next by thread: live support on SGI