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

Class SymbolicVariable

source code

                      object --+                    
                               |                    
structure.sage_object.SageObject --+                
                                   |                
           structure.element.Element --+            
                                       |            
         structure.element.ModuleElement --+        
                                           |        
               structure.element.RingElement --+    
                                               |    
                              SymbolicExpression --+
                                                   |
                                                  SymbolicVariable


A symbolic variable, which is a calculus object.

EXAMPLES:
    sage: z = var('z')
    sage: type(z)
    <class 'sage.calculus.calculus.SymbolicVariable'>



Instance Methods [hide private]
 
__init__(self, name)
Create a symbolic expression.
source code
 
__hash__(self)
Return the hash of this symbolic variable, which is just the hash of the underlying name (as a string).
source code
 
_fast_float_(self, *vars)
Returns a quickly-evaluating function with named parameters \code{vars}.
source code
 
_recursive_sub(self, kwds) source code
 
_recursive_sub_over_ring(self, kwds, ring) source code
 
variables(self, vars=())
Return sorted list of variables that occur in the simplified form of \code{self}.
source code
 
number_of_arguments(self)
Returns the number of arguments of \code{self}.
source code
 
__cmp__(self, right)
Compares self and right.
source code
 
_repr_(self, simplify=True)
File: sage/structure/element.pyx (starting at line 291)
source code
 
__str__(self)
Printing an object explicitly gives ASCII art:...
source code
 
_latex_(self) source code
 
_maxima_init_(self)
File: sage/structure/sage_object.pyx (starting at line 318)
source code
 
_sys_init_(self, system) source code

Inherited from SymbolicExpression: __abs__, __call__, __eq__, __ge__, __gt__, __int__, __le__, __long__, __lt__, __ne__, __nonzero__, __pow__, _add_, _axiom_init_, _complex_double_, _complex_mpfr_field_, _div_, _gap_init_, _gp_init_, _integer_, _kash_init_, _macaulay2_init_, _magma_init_, _maple_init_, _mathematica_init_, _maxima_, _mpfr_, _mul_, _neg_, _octave_init_, _pari_init_, _polynomial_, _rational_, _real_double_, _real_rqdf_, _richcmp_, _singular_init_, _sub_, arguments, coeff, coefficient, coefficients, coeffs, combine, conjugate, default_variable, denominator, derivative, diff, differentiate, display2d, exp_simplify, expand, expand_rational, expand_trig, factor, factor_list, find_maximum_on_interval, find_minimum_on_interval, find_root, full_simplify, function, gradient, hessian, imag, integral, integrate, inverse_laplace, laplace, limit, log_simplify, minpoly, n, nintegral, nintegrate, norm, numerator, numerical_approx, partial_fraction, plot, poly, polynomial, power_series, radical_simplify, rational_expand, rational_simplify, real, roots, show, simplify, simplify_exp, simplify_full, simplify_log, simplify_radical, simplify_rational, simplify_trig, solve, subs, subs_expr, substitute, substitute_over_ring, taylor, trig_expand, trig_simplify

Inherited from structure.element.RingElement: __div__, __idiv__, __imul__, __invert__, __mul__, __new__, __pos__, __rdiv__, __rmul__, __rpow__, __rtruediv__, __truediv__, _idiv_, _imul_, abs, additive_order, is_nilpotent, is_one, is_unit, multiplicative_order, order

Inherited from structure.element.ModuleElement: __add__, __iadd__, __isub__, __neg__, __radd__, __rsub__, __sub__, _iadd_, _ilmul_, _isub_, _lmul_, _rmul_

Inherited from structure.element.Element: __reduce__, __rxor__, __xor__, _cmp_, _im_gens_, base_base_extend, base_base_extend_canonical_sym, base_extend, base_extend_canonical, base_extend_canonical_sym, base_extend_recursive, base_ring, category, is_zero, parent

Inherited from structure.sage_object.SageObject: __repr__, _axiom_, _gap_, _gp_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _macaulay2_, _magma_, _maple_, _mathematica_, _octave_, _pari_, _r_init_, _sage_, _singular_, db, dump, dumps, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 

Create a symbolic expression.

EXAMPLES:
This example is mainly for testing purposes.

We explicitly import the SymbolicExpression class.
    sage: from sage.calculus.calculus import SymbolicExpression

Then we make an instance of it.  Note that it prints as a
``generic element'', since it doesn't even have a specific
value!
    sage: a = SymbolicExpression(); a
    Generic element of a structure

It's of the right type.
    sage: type(a)
    <class 'sage.calculus.calculus.SymbolicExpression'>

And it has the right parent. 
    sage: a.parent()
    Symbolic Ring        

Overrides: SymbolicExpression.__init__
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

Return the hash of this symbolic variable, which is just the
hash of the underlying name (as a string).

EXAMPLES:
    sage: z = var('z')
    sage: hash(z) #random due to architecture dependence
    -1563822213
    sage: hash('z') #random due to architecture dependence
    -1563822213

Overrides: SymbolicExpression.__hash__

_fast_float_(self, *vars)

source code 

Returns a quickly-evaluating function with named parameters 
\code{vars}. Specifically, if \code{self} is the $n$-th parameter
it returns a function extracting the $n$-th item out of a tuple. 

EXAMPLES: 
    sage: f = x._fast_float_('x', 'y')
    sage: f(1,2)
    1.0
    sage: f = x._fast_float_('y', 'x')
    sage: f(1,2)
    2.0
    sage: sqrt(2)._fast_float_()(2)
    1.4142135623730951

Overrides: SymbolicExpression._fast_float_

_recursive_sub(self, kwds)

source code 
Overrides: SymbolicExpression._recursive_sub

_recursive_sub_over_ring(self, kwds, ring)

source code 
Overrides: SymbolicExpression._recursive_sub_over_ring

variables(self, vars=())

source code 

Return sorted list of variables that occur in the simplified
form of \code{self}.

Overrides: SymbolicExpression.variables

number_of_arguments(self)

source code 

Returns the number of arguments of \code{self}.

EXAMPLES:
    sage: x = var('x')
    sage: x.number_of_arguments()
    1

Overrides: SymbolicExpression.number_of_arguments

__cmp__(self, right)
(Comparison operator)

source code 

Compares self and right.

This is by definition the comparison of the underlying Maxima
objects, if right coerces to a symbolic (otherwise types are
compared).  It is not used unless you explicitly call cmp,
since all the other special comparison methods are overloaded.

EXAMPLES:
These two are equal:
    sage: cmp(e+e, e*2)
    0
    sage: cmp(SR(3), SR(5))
    -1
    sage: cmp(SR(5), SR(2))
    1

Note that specifiec comparison operators do not call cmp.
    sage: SR(3) < SR(5)
    3 < 5
    sage: bool(SR(3) < SR(5))
    True

We compare symbolic elements with non symbolic ones. 
    sage: cmp(SR(3), 5)
    -1
    sage: cmp(3, SR(5))
    -1

Here the underlying types are compared, since Mod(2,5)
doesn't coerce to the symbolic ring.
    sage: cmp(SR(3), Mod(2,5)) #random due to architecture dependence
    1
    sage: cmp(type(SR(3)), type(Mod(2,5))) #random due to architecture dependence
    1
    sage: cmp(Mod(2,5), SR(3) ) #random due to architecture dependence
    -1

Some comparisons are fairly arbitrary but consistent:
    sage: cmp(SR(3), x) #random due to architecture dependence
    -1
    sage: cmp(x, SR(3)) #random due to architecture dependence
    1

Overrides: SymbolicExpression.__cmp__
(inherited documentation)

_repr_(self, simplify=True)

source code 
File: sage/structure/element.pyx (starting at line 291)

Overrides: structure.element.Element._repr_
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

Printing an object explicitly gives ASCII art:

EXAMPLES:
    sage: var('x y')
    (x, y)
    sage: f = y^2/(y+1)^3 + x/(x-1)^3
    sage: f
    y^2/(y + 1)^3 + x/(x - 1)^3
    sage: print f
                                      2
                                     y          x
                                  -------- + --------
                                         3          3
                                  (y + 1)    (x - 1)

    sage: f = (exp(x)-1)/(exp(x/2)+1)
    sage: g = exp(x/2)-1
    sage: print f(10), g(10)
                             10
                            e   - 1
                           --------
                             5
                            e  + 1 
                              5
                             e  - 1

Overrides: SymbolicExpression.__str__
(inherited documentation)

_maxima_init_(self)

source code 
File: sage/structure/sage_object.pyx (starting at line 318)

Overrides: SymbolicExpression._maxima_init_

_sys_init_(self, system)

source code 
Overrides: SymbolicExpression._sys_init_