Package sage :: Package rings :: Module qqbar :: Class ANDescr
[hide private]
[frames] | no frames]

Class ANDescr

source code

                      object --+    
                               |    
structure.sage_object.SageObject --+
                                   |
                                  ANDescr
Known Subclasses:
ANBinaryExpr, ANExtensionElement, ANRational, ANRoot, ANRootOfUnity, ANUnaryExpr


An AlgebraicNumber or AlgebraicReal is a wrapper around an ANDescr object.
ANDescr is an abstract base class, which should never
be directly instantiated; its concrete subclasses are
ANRational, ANBinaryExpr, ANUnaryExpr, ANRootOfUnity,
ANRoot, and ANExtensionElement.
ANDescr and all of its subclasses are private, and
should not be used directly.    



Instance Methods [hide private]
 
is_exact(self)
Returns True if self is an ANRational, ANRootOfUnity, or ANExtensionElement.
source code
 
is_simple(self)
Checks whether this descriptor represents a value with the same algebraic degree as the number field associated with the descriptor.
source code
 
is_rational(self)
Returns True if self is an ANRational object.
source code
 
is_field_element(self)
Returns True if self is an ANExtensionElement.
source code
 
neg(self, n) source code
 
invert(self, n) source code
 
abs(self, n) source code
 
real(self, n) source code
 
imag(self, n) source code
 
conjugate(self, n) source code
 
norm(self, n) source code

Inherited from structure.sage_object.SageObject: __hash__, __new__, __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_, category, db, dump, dumps, plot, rename, reset_name, save, version

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

is_exact(self)

source code 

Returns True if self is an ANRational, ANRootOfUnity, or
ANExtensionElement.

EXAMPLES:
    sage: from sage.rings.qqbar import ANRational
    sage: ANRational(1/2).is_exact()
    True
    sage: QQbar(3+I)._descr.is_exact()
    True
    sage: QQbar.zeta(17)._descr.is_exact()
    True

is_simple(self)

source code 

Checks whether this descriptor represents a value with the same
algebraic degree as the number field associated with the descriptor.

Returns \code{True} if self is an \class{ANRational},
\class{ANRootOfUnity}, or a minimal \class{ANExtensionElement}.

EXAMPLES:
    sage: from sage.rings.qqbar import ANRational
    sage: ANRational(1/2).is_simple()
    True
    sage: rt2 = AA(sqrt(2))
    sage: rt3 = AA(sqrt(3))
    sage: rt2b = rt3 + rt2 - rt3
    sage: rt2.exactify()
    sage: rt2._descr.is_simple()
    True
    sage: rt2b.exactify()
    sage: rt2b._descr.is_simple()
    False
    sage: rt2b.simplify()
    sage: rt2b._descr.is_simple()
    True

is_rational(self)

source code 

Returns True if self is an ANRational object.  (Note that
the constructors for ANExtensionElement and ANRootOfUnity
will actually return ANRational objects for rational numbers.)

EXAMPLES:
    sage: from sage.rings.qqbar import ANRational
    sage: ANRational(3/7).is_rational()
    True

is_field_element(self)

source code 

Returns True if self is an ANExtensionElement.

    sage: from sage.rings.qqbar import ANExtensionElement, ANRoot, AlgebraicGenerator
    sage: _.<y> = QQ['y']
    sage: x = polygen(QQbar)
    sage: nf2 = NumberField(y^2 - 2, name='a', check=False)
    sage: root2 = ANRoot(x^2 - 2, RIF(1, 2))
    sage: gen2 = AlgebraicGenerator(nf2, root2)
    sage: sqrt2 = ANExtensionElement(gen2, nf2.gen())
    sage: sqrt2.is_field_element()
    True