Package sage :: Package calculus :: Module calculus :: Class SymbolicExpressionRing_class
[hide private]
[frames] | no frames]

Class SymbolicExpressionRing_class

source code

                                          object --+    
                                                   |    
                                                uniq --+
                                                       |
                      object --+                       |
                               |                       |
structure.sage_object.SageObject --+                   |
                                   |                   |
             structure.parent.Parent --+               |
                                       |               |
    structure.parent_base.ParentWithBase --+           |
                                           |           |
        structure.parent_gens.ParentWithGens --+       |
                                               |       |
                                 rings.ring.Ring --+   |
                                                   |   |
                          rings.ring.CommutativeRing --+
                                                       |
                                                      SymbolicExpressionRing_class


The ring of all formal symbolic expressions.

EXAMPLES:
    sage: SR
    Symbolic Ring
    sage: type(SR)
    <class 'sage.calculus.calculus.SymbolicExpressionRing_class'>

TESTS:
Test serializing:
    sage: loads(dumps(SR)) == SR
    True



Instance Methods [hide private]
 
__init__(self, default_precision=53)
Create a symbolic expression ring.
source code
 
__cmp__(self, other)
Compare two symbolic expression rings.
source code
 
__contains__(self, x)
True if there is an element of the symbolic ring that is equal to x under ==.
source code
 
__call__(self, x)
Coerce $x$ into the symbolic expression ring SR.
source code
 
_coerce_impl(self, x)
Used for implicit coercion.
source code
 
_repr_(self)
Return string representation of this symbolic ring.
source code
 
_latex_(self)
Return latex representation of the symbolic ring.
source code
 
var(self, x)
Return the symbolic variable defined by x as an element of the symbolic ring.
source code
 
characteristic(self)
Return the characteristic of the symbolic ring, which is 0.
source code
 
_an_element_impl(self)
Return an element of the symbolic ring, which is used by the coercion model.
source code
 
is_field(self)
Returns True, since the symbolic expression ring is (for the most part) a field.
source code
 
is_exact(self)
Return False, because there are approximate elements in the symbolic ring.
source code

Inherited from rings.ring.CommutativeRing: __div__, __pow__, __rdiv__, __rpow__, extension, fraction_field, ideal_monoid, is_commutative, krull_dimension, quo, quotient, quotient_ring

Inherited from rings.ring.Ring: __getitem__, __hash__, __iter__, __len__, __mul__, __rmul__, __rxor__, __xor__, _ideal_class_, base_extend, category, ideal, is_atomic_repr, is_finite, is_integral_domain, is_noetherian, is_prime_field, is_ring, is_subring, one_element, order, principal_ideal, random_element, unit_ideal, zero_element, zero_ideal, zeta, zeta_order

Inherited from rings.ring.Ring (private): _r_action

Inherited from structure.parent_gens.ParentWithGens: __getslice__, __getstate__, __setstate__, _is_valid_homomorphism_, gen, gens, gens_dict, hom, inject_variables, injvar, latex_name, latex_variable_names, list, ngens, objgen, objgens, variable_name, variable_names

Inherited from structure.parent_base.ParentWithBase: Hom, base, base_extend_canonical, base_extend_canonical_sym, base_extend_recursive, base_ring

Inherited from structure.parent.Parent: _coerce_, coerce_map_from, coerce_map_from_impl, construction, get_action, get_action_impl, has_coerce_map_from, has_coerce_map_from_impl, init_coerce

Inherited from structure.sage_object.SageObject: __repr__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _magma_init_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _maxima_, _maxima_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, db, dump, dumps, plot, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__, __str__

Static Methods [hide private]

Inherited from uniq: __new__

Properties [hide private]

Inherited from structure.parent.Parent (private): _has_coerce_map_from

Inherited from object: __class__

Method Details [hide private]

__init__(self, default_precision=53)
(Constructor)

source code 

Create a symbolic expression ring.

EXAMPLES:
    sage: from sage.calculus.calculus import SymbolicExpressionRing_class
    sage: SymbolicExpressionRing_class()
    Symbolic Ring

Overrides: structure.parent_gens.ParentWithGens.__init__

__cmp__(self, other)
(Comparison operator)

source code 

Compare two symbolic expression rings.  They are equal if and
only if they have the same type. Otherwise their types are
compared.

EXAMPLES:
    sage: cmp(SR, RR) #random
    1
    sage: cmp(RR, SymbolicExpressionRing()) #random
    -1
    sage: cmp(SR, SymbolicExpressionRing()) #random
    0

__contains__(self, x)
(In operator)

source code 

True if there is an element of the symbolic ring  that is equal
to x under ==.

EXAMPLES:
The symbolic variable x is in the symbolic ring.
    sage: x.parent()
    Symbolic Ring
    sage: x in SR
    True

2 is also in the symbolic ring since it is equal to something
in SR, even though 2's parent is not SR.
    sage: 2 in SR
    True
    sage: parent(2)
    Integer Ring
    sage: 1/3 in SR
    True

The finite field element 1 (in GF(3)) is not equal to
anything in SR. 
    sage: GF(3)(1) in SR
    False

Overrides: structure.parent.Parent.__contains__

__call__(self, x)
(Call operator)

source code 

Coerce $x$ into the symbolic expression ring SR.

EXAMPLES:
    sage: a = SR(-3/4); a
    -3/4
    sage: type(a)
    <class 'sage.calculus.calculus.SymbolicConstant'>
    sage: a.parent()
    Symbolic Ring
    sage: type(SR(I))
    <class 'sage.calculus.calculus.SymbolicConstant'>
    sage: is_SymbolicExpression(SR(I))
    True

If $a$ is already in the symblic expression ring, coercing returns
$a$ itself (not a copy):
    sage: SR(a) is a
    True

A Python complex number:
    sage: SR(complex(2,-3))
    2.00000000000000 - 3.00000000000000*I

Overrides: rings.ring.Ring.__call__

_coerce_impl(self, x)

source code 

Used for implicit coercion.

EXAMPLES:
    sage: x=var('x'); y0,y1=PolynomialRing(ZZ,2,'y').gens()
    sage: x+y0/y1
    y0/y1 + x
    sage: x.subs(x=y0/y1)
    y0/y1

Overrides: structure.parent.Parent._coerce_impl

_repr_(self)

source code 

Return string representation of this symbolic ring.

EXAMPLES:
    sage: SR._repr_()
    'Symbolic Ring'

_latex_(self)

source code 

Return latex representation of the symbolic ring.

EXAMPLES:
    sage: latex(SR)
        ext{SR}
    sage: M = MatrixSpace(SR, 2); latex(M)
    \mbox{
m Mat}_{2       imes 2}(        ext{SR})

var(self, x)

source code 

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)
    <class 'sage.calculus.calculus.SymbolicVariable'>
    sage: t = SR.var('theta2'); t
    theta2        

characteristic(self)

source code 

Return the characteristic of the symbolic ring, which is 0.

OUTPUT:
    a Sage integer

EXAMPLES:
    sage: c = SR.characteristic(); c
    0
    sage: type(c)
    <type 'sage.rings.integer.Integer'>        

Overrides: rings.ring.Ring.characteristic

_an_element_impl(self)

source code 

Return an element of the symbolic ring, which is used
by the coercion model.

EXAMPLES:
Currently this function always returns 0.  That may change.
    sage: SR._an_element_impl()
    0        

Overrides: structure.parent.Parent._an_element_impl

is_field(self)

source code 

Returns True, since the symbolic expression ring is (for the
most part) a field.

EXAMPLES:
    sage: SR.is_field()
    True

Overrides: rings.ring.Ring.is_field

is_exact(self)

source code 

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        

Overrides: rings.ring.Ring.is_exact