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

I've noticed that one can assign names to expression using either := or =.

  • What is the difference between them?
  • How to assign silently in both cases? Why does it changes?
in General questions by (8.0k points)

1 Answer

+1 vote
Best answer

':=' wants a mathematical expression on the right-hand side, and then converts that to an Ex object, before it assigns it to the python symbol on the left-hand side.

'=' wants a python object on the right-hand side.

So you can do

ex := A_{m n};

but you cannot do

ex = A_{m n};

because the right-hand side of the latter expression is not python.

To suppress output, use a ':' to terminate the line when you use the ':=' form, or simply nothing if you use the '=' construction.

by (65.1k points)
selected by