MathGroup Archive 1996

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

Search the Archive

Re: Replace/No Rearrangement

  • To: mathgroup at
  • Subject: [mg5349] Re: Replace/No Rearrangement
  • From: Jens Potschadtke <Jens.Potschadtke at>
  • Date: Wed, 27 Nov 1996 01:48:02 -0500
  • Organization: Institute for Biomedical Engineering at the FAU Erlangen
  • Sender: owner-wri-mathgroup at

Susan Rempe wrote:
> Hi,
>         I have an expression and I want to replace several
> parts, so I don't  want rearrangement.  For example,
>         t=a+b+c+d
>         t[[2]]=x
> Mathematica reorders the function
>         Out[47]= a + c + d + x
> Instead, I want the output this way
>         a+x+c+d
> Any ideas??  Thanks,
>         Susan Rempe
>         rempe at

The point is that Plus[] has the attribute Orderless. In any calulation
Plus[] tries any possible combination of the supplied arguments.
Take a look at 


To remove the attributes use something like:


But take care! It is not recommended to do so!!! Because any further
calculation which uses Plus[] may have another result as one may 
expect. For a closer look consult the Mathematica book on behalf

Another approach:

If you really only want to replace some parts in your equation
use for your simple example:

Apply[t,List]; (* replaces the head "Plus" by "List" *)
any replacement

I hope this gives you an idea how to solve even more complicated

Jens Potschadtke

Institute for biomedical engineering at the FAU Erlangen (germany).

mailto:Jens.Potschadtke at

  • Prev by Date: Re: Formatting Output
  • Previous by thread: Re: Replace/No Rearrangement
  • Next by thread: DMUG (German Mathematica User Group)