Bug introduced in 14.0, fixed in 14.1.
The Wolfram documentation says that Ket[{k}]
is displayed as
$$
\vert k \rangle
$$
However, I am following the discussion from this thread https://www.reddit.com/r/Mathematica/comments/9wnxu7/bosonic_fock_states/ which gives some code:
qOperatorQ[expr_] :=
MatchQ[expr,
qCO[_Integer] | qDO[_Integer] | Ket[{__Integer}] |
Times[scalar_?NumericQ, _?qOperatorQ] |
Plus[op_?qOperatorQ, _?qOperatorQ] |
CenterDot[op_?qOperatorQ, _?qOperatorQ]];
(*implement action on Fock states*)
CenterDot[left___, qCO[k_Integer], Ket[{n__Integer}]] := Module[
{l = Max[Length[{n}], k], nn},
nn = PadRight[{n}, l];
Times[Sqrt[nn[[k]] + 1],
CenterDot[left, Ket[nn + UnitVector[l, k]]]] ];
(*effective OneIdentity attribute*)
CenterDot[op_?qOperatorQ] := op;
With these definitions, we can compute $$ a_1^\dagger\vert 0 0 \rangle $$ by evaluating
qCO[1]\[CenterDot]Ket[{0, 0}]
My expectation is that this would output as
$$|1,0\rangle$$
Instead, I get output that appears to be in input form:
Ket[{1,0}]
(re)Evaluating this output or manually changing the format of the output cell produces the desired form. Is there some reason that the provided code does not print the output in the expected format?
This issue arises in my installation of Mathematica 14.0.0.0.
CenterDot[op_?qOperatorQ]:=(op +1) -1;
which does not modify the value of the output. $\endgroup$Ket[{0}]
displays as expected in a notebook, nor can I reproduce the issue mentioned here: i.sstatic.net/Aeu4S78J.png Also, you mentionDisplayForm
several times but your code doesn't callDisplayForm
so that is a bit confusing. $\endgroup$