Bases: sage.rings.ring.CommutativeRing
Symbolic Ring, parent object for all symbolic expressions.
Return the characteristic of the symbolic ring, which is 0.
OUTPUT:
EXAMPLES:
sage: c = SR.characteristic(); c
0
sage: type(c)
<type 'sage.rings.integer.Integer'>
Return False, because there are approximate elements in the symbolic ring.
EXAMPLES:
sage: SR.is_exact()
False
Here is an inexact element.
sage: SR(1.9393)
1.93930000000000
Returns True, since the symbolic expression ring is (for the most part) a field.
EXAMPLES:
sage: SR.is_field()
True
EXAMPLES:
sage: SR.pi() is pi
True
EXAMPLES:
sage: t0 = SR.symbol("t0")
sage: t0.conjugate()
conjugate(t0)
sage: t1 = SR.symbol("t1", domain='real')
sage: t1.conjugate()
t1
sage: t0.abs()
abs(t0)
sage: t0_2 = SR.symbol("t0", domain='positive')
sage: t0_2.abs()
t0
sage: bool(t0_2 == t0)
True
sage: t0.conjugate()
t0
sage: SR.symbol() # temporary variable
symbol...
Return the symbolic variable defined by x as an element of the symbolic ring.
EXAMPLES:
sage: zz = SR.var('zz'); zz
zz
sage: type(zz)
<type 'sage.symbolic.expression.Expression'>
sage: t = SR.var('theta2'); t
theta2
Return the n-th wild-card for pattern matching and substitution.
INPUT:
OUTPUT:
EXAMPLES:
sage: x,y = var('x,y')
sage: w0 = SR.wild(0); w1 = SR.wild(1)
sage: pattern = sin(x)*w0*w1^2; pattern
$0*$1^2*sin(x)
sage: f = atan(sin(x)*3*x^2); f
arctan(3*x^2*sin(x))
sage: f.has(pattern)
True
sage: f.subs(pattern == x^2)
arctan(x^2)
Returns True if R is the symbolic expression ring.
EXAMPLES:
sage: from sage.symbolic.ring import is_SymbolicExpressionRing
sage: is_SymbolicExpressionRing(ZZ)
False
sage: is_SymbolicExpressionRing(SR)
True
Returns True if x is a variable.
EXAMPLES:
sage: from sage.symbolic.ring import is_SymbolicVariable
sage: is_SymbolicVariable(x)
True
sage: is_SymbolicVariable(x+2)
False
TESTS:
sage: ZZ[x]
Univariate Polynomial Ring in x over Integer Ring
Return the unique symbolic ring object.
(This is mainly used for unpickling.)
EXAMPLES:
sage: sage.symbolic.ring.the_SymbolicRing()
Symbolic Ring
sage: sage.symbolic.ring.the_SymbolicRing() is sage.symbolic.ring.the_SymbolicRing()
True
sage: sage.symbolic.ring.the_SymbolicRing() is SR
True
EXAMPLES:
sage: from sage.symbolic.ring import var
sage: var("x y z")
(x, y, z)
sage: var("x,y,z")
(x, y, z)
sage: var("x , y , z")
(x, y, z)
sage: var("z")
z