简化规则未正确应用

时间:2013-05-03 14:33:38

标签: symbolic-math maxima computer-algebra-systems

我正在尝试使用此处的代码http://raoul.koalatux.ch/sites/ladderoperator/ladder_operator.html

在Maxima中使用Dirac Bra-Ket表示法
declare(bra, nonscalar);
declare(ket, nonscalar);
dotscrules:true;
matchdeclare(m,lambda([t],featurep(t,integer)));
matchdeclare(n,lambda([t],featurep(t,integer)));

tellsimp(bra(m).ket(n), kron_delta(m,n));

对于大多数表达方式,它都有效:

bra(0) . ket(0);
ket(1) . bra(0) . ket(0);
bra(1) . ket(1) . bra(0) . ket(0);

所有都正确简化,但

bra(1) . ket(1) . bra(0);

无法简化为bra(0)。我怎样才能让Maxima简化这种情况呢?

1 个答案:

答案 0 :(得分:2)

我想你可以从这开始:

declare(bra, nonscalar);
declare(ket, nonscalar);
dotscrules:true;
matchdeclare(m,lambda([t],featurep(t,integer)));
matchdeclare(n,lambda([t],featurep(t,integer)));

tellsimp(bra(m).ket(n), kron_delta(m,n));

simp:false;
matchdeclare(aa, true);
matchdeclare(bb, true);
matchdeclare(cc, true);
tellsimp (aa.(bb.cc),(aa.bb).cc);
simp:true;

/* Tests */
bra(0) . ket(0);
ket(1) . bra(0) . ket(0);
bra(1) . ket(1) . bra(0) . ket(0);
bra(1) . ket(1) . bra(0);
ket(1) . bra(1) . ket(1);