MathGroup Archive 2004

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

Search the Archive

Re: Re: Question about Hold

    Thanks for all your help, also sorry for some uncertainty about the fact the questions is quite straightforward:
    e.g i define Commute[A,B]=C (all operators), how to let mathematica 
knows Commute[A^2,B]=AC+CA.
    I figure out one solutions later.

     RowBox[{\(Commute[a_\^n_Integer, b_] /; n > 1\), ":=",
           RowBox[{"Commute", "[",
               RowBox[{"Times", "@@",
                 RowBox[{"Table", "[",
                   StyleBox[\(SubscriptBox[a, i], {i, n}\),
                     "MR"], "]"}]}],
              ",", "b"}], "]"}], ")"}], "/.", \(SubscriptBox[
               a, _] :> a\)}]}], ";"}]\)

kinda of foolish:).
Jens give a simple solution, altough (Commute[a,b]=ab-ba)
Commute[a^n_, b] := AntiCommute[a^(n - 1), Commute[a, b]]

  • Prev by Date: AW: Overlay graphs
  • Next by Date: Re: exporting and importing AI and EPS files
  • Previous by thread: Re: Question about Hold
  • Next by thread: Controlling function arguments