FractionFieldSequence and SequenceFieldOfFraction

Field of fractions of a sequence ring.

Defines a ring which is the fraction field of a sequence ring where all sequences contain at most finitely many zeros (or are the zero sequence). A fraction of two such sequences can therefore be evaluated at almost all points.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: QC = SequenceFieldOfFraction(C)

sage: a = QC(C([3,0,-1], [1,3]), C([2,-1], [1]))
sage: a
Fraction sequence:
> Numerator: C-finite sequence a(n): (3)*a(n) + (-1)*a(n+2) = 0 
and a(0)=1 , a(1)=3
> Denominator: C-finite sequence a(n): (2)*a(n) + (-1)*a(n+1) = 0 and a(0)=1
sage: b = QC(C([1,-1], [2]))

sage: c = a*b
sage: c[:10]
[2, 3, 3/2, 9/4, 9/8, 27/16, 27/32, 81/64, 81/128, 243/256]
sage: a_inv = ~a
sage: a_inv*a == 1
True
class rec_sequences.SequenceFieldOfFraction.FractionFieldSequence(parent, numerator, denominator, name='a', is_gen=False, construct=False, cache=True)

Bases: rec_sequences.SequenceRingOfFraction.FractionSequence, sage.structure.element.FieldElement

A fraction sequence, i.e. a fraction where both numerator and denominator are coming from a ring of sequences.

__init__(parent, numerator, denominator, name='a', is_gen=False, construct=False, cache=True)

Construct a fraction sequence numerator/denominator.

Note

It is not checked whether numerator and denominator only contain finitely many zeros.

INPUT:

  • parent – a SequenceRingOfFraction

  • numerator – the numerator of the fraction which is either the zero sequence or only contains finitely many zeros.

  • denominator – the denominator of the fraction which only contains finitely many zeros.

  • name (default “a”) – a name for the sequence

OUTPUT:

A fraction sequence numerator/denominator.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: QC = SequenceFieldOfFraction(C)

sage: QC(C([3,-1], [1]), C([2,-1], [1]))
Fraction sequence:
> Numerator: C-finite sequence a(n): (3)*a(n) + (-1)*a(n+1) = 0 
and a(0)=1
> Denominator: C-finite sequence a(n): (2)*a(n) + (-1)*a(n+1) = 0
and a(0)=1
__invert__()

Computes the inverse of the sequence.

OUTPUT:

The multiplicative inverse of the sequence.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: QC = SequenceFieldOfFraction(C)

sage: c = C([1,1,-1], [0,1])
sage: d = C([3,1], [1])
sage: b = QC(c.shift(), d)
sage: ~b*b == 1
True
is_unit()

Check whether sequence is multiplicative unit.

OUTPUT:

Return True if self is not zero.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: QC = SequenceFieldOfFraction(C)

sage: c = C([1,1,-1], [0,1])
sage: d = C([3,1], [1])
sage: a = QC(c, d)
sage: b = QC(c, C(1))
sage: a.is_unit()
True
sage: b.is_unit()
True
sage: (a+1).is_unit()
True
class rec_sequences.SequenceFieldOfFraction.SequenceFieldOfFraction(base, name=None, element_class=None, category=None)

Bases: rec_sequences.SequenceRingOfFraction.SequenceRingOfFraction

The field of fractions over a ring of sequences.

Element

alias of rec_sequences.SequenceFieldOfFraction.FractionFieldSequence

__init__(base, name=None, element_class=None, category=None)

Constructor for a sequence field of fractions.

INPUT:

  • base – a base ring which represents a sequence ring

OUTPUT:

A sequence field of fraction over the given base.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: SequenceFieldOfFraction(C)
Sequence field of fractions over Ring of C-finite sequences over 
Rational Field
_repr_()

OUTPUT:

A string representation of the sequence field of fractions.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: SequenceFieldOfFraction(C)
Sequence field of fractions over Ring of C-finite sequences over 
Rational Field
change_base_ring(R)

OUTPUT:

Return a copy of self but with the base \(R\)

construction()

Shows how the given ring can be constructed using functors.

OUTPUT:

A functor F and a ring R such that F(R)==self

is_commutative()

Returns whether self is a commutative ring. This is the case.

OUTPUT:

True

is_field(proof=True)

Returns whether self is a field. This is the case.

OUTPUT:

True

is_integral_domain(proof=True)

Returns whether self is an integral domain. This is the case.

OUTPUT:

True

is_noetherian()

Returns whether self is a Noetherian ring. This is the case.

OUTPUT:

True

random_element(*args, **kwds)

OUTPUT:

Return a random fraction sequence. This is done by creating a random numerator and random denominator. Any additional arguments are passed to the random_element method of the base ring.

EXAMPLES:

sage: from rec_sequences.SequenceFieldOfFraction import *
sage: from rec_sequences.CFiniteSequenceRing import *

sage: C = CFiniteSequenceRing(QQ)
sage: QC = SequenceRingOfFraction(C)
sage: QC.random_element()[:5] # random
[-8/3, 2, -81/28, 99/112, -1269/896]
class rec_sequences.SequenceFieldOfFraction.SequenceFieldOfFractionFunctor

Bases: rec_sequences.SequenceRingOfFraction.SequenceRingOfFractionFunctor

__eq__(other)

Equality here means that they are mathematically equivalent, though they may have specific implementation data. This method will usually be overloaded in subclasses. by default, only the types of the functors are compared. Also see the merge() function.

TESTS:

sage: from sage.categories.pushout import IdentityConstructionFunctor
sage: I = IdentityConstructionFunctor()
sage: F = QQ.construction()[0]
sage: P = ZZ['t'].construction()[0]
sage: I == F        # indirect doctest
False
sage: I == I        # indirect doctest
True
__init__()

Constructs a SequenceFieldOfFractionFunctor.

_repr_()

Returns a string representation of the functor.

OUTPUT:

The string “SequenceFieldOfFraction(*)” .

merge(other)

Merge self with another construction functor, or return None.

Note

The default is to merge only if the two functors coincide. But this may be overloaded for subclasses, such as the quotient functor.

EXAMPLES:

sage: F = QQ.construction()[0]
sage: P = ZZ['t'].construction()[0]
sage: F.merge(F)
FractionField
sage: F.merge(P)
sage: P.merge(F)
sage: P.merge(P)
Poly[t]