I am trying to define some operators I use frequently. For example, I defined a KroneckerProduct
operator as $\otimes $ as follows:
a_⊗b_:=a.b-b.a
And this works fine.
Then I want to define a commutator used in quantum mechanics act like follows:
$${\left[ {a,b} \right]_ - } = a.b - b.a$$ $${\left[ {a,b} \right]_ + } = a.b + b.a$$
where a
and b
are matrices.
So I naively write the definition in Mathematica as follows:
$${\left[ {a{\rm{\_}},b{\rm{\_}}} \right]_ - }: = a.b - b.a$$ $${\left[ {a{\rm{\_}},b{\rm{\_}}} \right]_ + }: = a.b + b.a$$
But this will not work.
How do I define the commutator in this form (appearance)?
And why does the definition for
a_⊗b_
hold, but the similar definition for commutator[a_, b_]
does not hold?
There is another question which actually should create another post. But I choose just to add it here.
If I defined the KroneckerProduct
as the operator ⊗
in the way I did, then I found that in parallel computing, I can't simply distribute such a definition of ⊗
like:
DistributeDefinitions[⊗]
Mathematica doesn't allow me to do that. Of course the Parallelize
will not distribute the ⊗
definition automatically either. So if an expression contains a ⊗
, simply Parallelize
it, the computation will get stuck and no answer will come out.
So my second question is:
How do I distribute such an operator definition in parallel computing?
Notation
package is your friend. See wolfram link here $\endgroup$