Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to define some operators I used frequently.For example, I defined a KroneckerProduct operator as $ \otimes $ as follows:

a_$ \otimes $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 matrix.

So I naively write the definition in matheamtica 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.

1.So how to define commutator in this form (appearance)?

2.and why the definition for a_$\otimes$b_ hold, the similar definition for commutator [a_,b_]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 [CircleTimes] in the way I did, then I found that in parallel computing, I can't simply distribute such a definition of [CircleTimes] like:

DistributeDefinitions[$\otimes$]

Mathematica doesn't allow me to do that. Of course the 'Parallelize' will not distribute the $\otimes$ definition automatically either. So if an expression contains a $\otimes$, Simply 'Parallelize' it, the computation will get stuck and no answer will come out.

So my second question is

how to distribute such a operator definition in parallel computing ?

share|improve this question
    
Unfortunately I have no time for a complete answer now, but for the first part, Notation package is your friend. See wolfram link here –  Murta Jan 31 '13 at 10:59
add comment

2 Answers

Maybe it's this that you are looking for.

Using the notation Package you can write:

enter image description here

I used a image to show these yellow box. To create it, use the notation pallet that Popup when you call the Package. This is the pallet:

enter image description here

Use the second button to do your new notation.

More information about this in Wolfram help in this link.

share|improve this answer
add comment

Too long for a comment but not a complete answer. From the end

-I don't know how (or if it is possible) to distribute the operation in parallel computing.

-See this, and this question for defining a commutator.

In particular there is advice in the second one by Szabolics on how to use better notation if you don't like the one below.

-An anticommutator would be sufficiently defined by a rule I think, like so:

HoldAll[(l m + m l + l^2 + m m l )] /. {(a_ b_ + b_ a_) -> 
Anitcom[a, b], a_ a_ -> 0, a_^_->0}

Where you can define Anticom on a case by case basis.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.