Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes

Hi, I was just trying a simple computation and ran into a possible bug in evaluate. The following code works as expected:


dot_g := -2 K_{a b};                       # okay
# dot_g := -2 N K_{a b};                   # crash


for a in ["x","y","z"]:
   for b in ["x","y","z"]:
      Kdn.append("K_{"+a+" "+b+"} = K"+a+b)

Kdn_rl = Ex(','.join(Kdn));

evaluate (dot_g,Kdn_rl,rhsonly=True);

But if you un-comment the 4th line an error pops up:

TypeError: unsupported operand type(s) for *: 'Integer' and 'function'

Cheers, Leo

in Bug reports by (1.6k points)

1 Answer

0 votes
Best answer

Funky, it looks like sympy has reserved the meaning of the symbol N. With NN it works fine. Will have a look tomorrow.

by (80.4k points)
selected by

Thanks. Using NN or M fixes the problem. I also get errors using O or S though the errors are different. Probably all related.

This is now fixed in the version on github, feeding N, O and S correctly.

Thanks Kasper, that works :).