Ask Your Question

Revision history [back]

When you write R = SR.var('R'), the left-hand V is a Python name pointing to the right-hand SR.var('V'), which is a symbolic expression. Then when you write R = 3, the Python name R points to the integer 3, so there is no relationship anymore between R and SR.var('R'):

sage: R = SR.var('R')
sage: type(R)
<type 'sage.symbolic.expression.Expression'>
sage: R = 3
sage: type(R)
<type 'sage.rings.integer.Integer'>

If you want to substitute R with 3 in I, you should do:

sage: I.substitute({R:3})
1/3*V

When you write R = SR.var('R'), the left-hand VR is a Python name pointing to the right-hand SR.var('V')SR.var('R'), which is a symbolic expression. Then when you write R = 3, the Python name R points to the integer 3, so there is no relationship anymore between R and SR.var('R'):

sage: R = SR.var('R')
sage: type(R)
<type 'sage.symbolic.expression.Expression'>
sage: R = 3
sage: type(R)
<type 'sage.rings.integer.Integer'>

If you want to substitute R with 3 in I, you should do:

sage: I.substitute({R:3})
1/3*V