How does sage manages same name variables
Says I have 2 matrix named M in different cells how do they affect each other? Can it be dangerous?
add a comment
Says I have 2 matrix named M in different cells how do they affect each other? Can it be dangerous?
It does this:
sage: M = identity_matrix(2)
sage: M
[1 0]
[0 1]
sage: M = 4
sage: M
4
In the noteboook, the most recent evaluated cell with M= ...
will erase the previous affectation of the variable M
.
The magic function %whos
returns a table of type/value for each current variables that are defined and as you see, only one value is assigned to each variable:
sage: %whos
Variable Type Data/Info
--------------------------------------------------------
M Integer 4
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2020-04-26 00:09:06 +0100
Seen: 198 times
Last updated: Apr 26 '20