| Home | Trees | Indices | Help |
|---|
|
|
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'>
|
|||
|
Inherited from |
|||
|
|||
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
|
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
|
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
|
|
|
Return sorted list of variables that occur in the simplified
form of \code{self}.
|
Returns the number of arguments of \code{self}.
EXAMPLES:
sage: x = var('x')
sage: x.number_of_arguments()
1
|
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
|
File: sage/structure/element.pyx (starting at line 291)
|
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
|
File: sage/structure/sage_object.pyx (starting at line 318)
|
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:31 2008 | http://epydoc.sourceforge.net |