Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Re: Question about Hold

  • To: mathgroup at
  • Subject: [mg48862] Re: [mg48826] Re: Question about Hold
  • From: Daohua Song <ds2081 at>
  • Date: Sat, 19 Jun 2004 04:31:27 -0400 (EDT)
  • References: <carjrn$r76$> <>
  • Sender: owner-wri-mathgroup at

    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