TransWikia.com

Weird behavior of ℏ ([HBar]) symbol on TensorExpand

Mathematica Asked by Jacob Hilbert on December 1, 2020

I was trying to implement some tools to do commutators on quantum mechanics, just for fun. Then I noted a peculiarity:

In[1]  := TensorExpand[(-ℏ).a]
Out[1] := ℏ (-1).a

Which is not typical of any Symbol:

In[1]  := TensorExpand[(-b).a]
Out[1] := -b.a

I did a little test based on this answer to obtain a fair amount of special symbols:

codes = Table[
   ToString[FromCharacterCode[u], InputForm, 
    CharacterEncoding -> "Symbol"], {u, 0, 65535}];

lnames = Flatten@StringCases[codes, "\[" ~~ __ ~~ "]"];

symbols = Quiet[ToExpression[lnames]] /. {$Failed | Null -> Nothing};

And then which symbols came out of Dot with TensorExpand:

In[5]  := Cases[Map[TensorExpand[(-#).a] &, symbols], Except[Times[-1, _]]]
Out[5] := {ℏ (-1).a, E (-1).a, (-I).a, (-I).a}

I get that TensorExpand cannot figure out the dot product with -I, and that it takes away the E, as it has certain algebraic properties hard coded into it, but to me it seems weird that despite having different properties:

In[6]  := {Head[E], NumericQ[E]}
Out[6] := {Symbol, True}
In[7]  := {Head[ℏ], NumericQ[ℏ]}
Out[7] := {Symbol, False}

They are treated as the same by this TensorExpand thing.

Could you give me an insight on this special behaviour of ?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP