Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'strange bug in algebraic computation?' topicStudent Support Forum > General > "strange bug in algebraic computation?"

Help | Reply To Topic
Author Comment/Response
tino
07/18/04 07:35am

Hello,

I want to do some algebraic computations with quantum mechanics creation and annihilation operators. while programming I found this really strange bug. this is the little programm:

Clear[d,u,ConstQ,cre,ann];
Unprotect[NonCommutativeMultiply];
SetAttributes[NCM, {Flat, OneIdentity}];

ConstQ[a_] := True;
ConstQ[_] := False;
ConstQ[ann[a_, i_]] := False;
ConstQ[cre[a_, i_]] := False;

l_ ** (a_?ConstQ) := a * l;

The Programm is supposed to bring constants (which have ConstQ == True) to the first place in an expression.

Now for the following expression

cre[a, l] ** d[l]

it works perfect.

But any other letter instead of the "d" for example

cre[a, l] ** u[l]

stays at the second place.

I have checked ConstQ[u[k]] and ConstQ[d[k]] and its both true.
What could be the Problem? And how do I solve it?

thanks a lot
tino

URL: ,
Help | Reply To Topic