Protect built-in variables?
Is there a way to protect built-in variables? This means that I get a warning if I use code like this:
pi = 5
var('I')
Is there a way to protect built-in variables? This means that I get a warning if I use code like this:
pi = 5
var('I')
If you ever lose a constant, bring it back via their absolute references:
sage: pi = 3
sage: pi = sage.symbolic.constants.pi
sage: pi.n()
3.14159265358979
sage: sage.symbolic.constants.[TAB]
sage.symbolic.constants.Catalan
sage.symbolic.constants.Constant
sage.symbolic.constants.E
sage.symbolic.constants.EulerGamma
sage.symbolic.constants.Glaisher
sage.symbolic.constants.GoldenRatio
sage.symbolic.constants.I
sage.symbolic.constants.Khinchin
sage.symbolic.constants.Log2
sage.symbolic.constants.Mertens
sage.symbolic.constants.NaN
sage.symbolic.constants.NotANumber
sage.symbolic.constants.Pi
sage.symbolic.constants.TwinPrime
sage.symbolic.constants.catalan
sage.symbolic.constants.constants_name_table
sage.symbolic.constants.constants_table
sage.symbolic.constants.e
sage.symbolic.constants.euler_gamma
sage.symbolic.constants.glaisher
sage.symbolic.constants.golden_ratio
sage.symbolic.constants.infinity
sage.symbolic.constants.khinchin
sage.symbolic.constants.log2
sage.symbolic.constants.math
sage.symbolic.constants.mertens
sage.symbolic.constants.minus_infinity
sage.symbolic.constants.partial
sage.symbolic.constants.pi
sage.symbolic.constants.sage
sage.symbolic.constants.twinprime
sage.symbolic.constants.unpickle_Constant
sage.symbolic.constants.unsigned_infinity
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2015-06-04 05:26:27 +0100
Seen: 650 times
Last updated: Jun 04 '15
How to magically define variables and use functional notation instead of methods
How can I clear an assignment to a variable?
implicitly defining a sequence of variables
Assigning variable values in a program
Finding integer solutions to systems of polynomial equations