Re: Re: Question about Hold
- To: mathgroup at smc.vnet.net
- Subject: [mg48862] Re: [mg48826] Re: Question about Hold
- From: Daohua Song <ds2081 at columbia.edu>
- Date: Sat, 19 Jun 2004 04:31:27 -0400 (EDT)
- References: <carjrn$r76$1@smc.vnet.net> <200406180612.CAA10664@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi,Steve...
Thanks for all your help, also sorry for some uncertainty about the
questions.in 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[{
RowBox[{\(Commute[a_\^n_Integer, b_] /; n > 1\), ":=",
RowBox[{
RowBox[{"(",
RowBox[{"Commute", "[",
RowBox[{
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]]
- References:
- Re: Question about Hold
- From: "Steve Luttrell" <steve_usenet@_removemefirst_luttrell.org.uk>
- Re: Question about Hold