Ask Your Question

Revision history [back]

Use a third variable:

sage: protected_pi = pi
sage: pi = 3
sage: pi.n()
3.00000000000000
sage: pi = protected_pi
sage: pi.n()
3.14159265358979
sage: protected_pi = pi

Use a third variable:

sage: protected_pi = pi
sage: pi = 3
sage: pi.n()
3.00000000000000
sage: pi = protected_pi
sage: pi.n()
3.14159265358979
sage: protected_pi = pi

Use If you ever lose a third variable:constant, bring it back via their absolute references:

sage: protected_pi = pi
sage: pi = 3
sage: pi.n()
3.00000000000000
sage: pi = protected_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.LimitedPrecisionConstant
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.brun
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

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.LimitedPrecisionConstant
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.brun
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

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.LimitedPrecisionConstant
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