Formal sums

AUTHORS:

  • David Harvey (2006-09-20): changed FormalSum not to derive from “list” anymore, because that breaks new Element interface
  • Nick Alexander (2006-12-06): added test cases.
  • William Stein (2006, 2009): wrote the first version in 2006, documented it in 2009.
FUNCTIONS:
  • FormalSums(ring) – create the module of formal finite sums with

    coefficients in the given ring.

  • FormalSum(list of pairs (coeff, number)) – create a formal sum

EXAMPLES:

sage: A = FormalSum([(1, 2/3)]); A
2/3
sage: B = FormalSum([(3, 1/5)]); B
3*1/5
sage: -B
-3*1/5
sage: A + B
3*1/5 + 2/3 
sage: A - B
-3*1/5 + 2/3
sage: B*3
9*1/5
sage: 2*A
2*2/3
sage: list(2*A + A)
[(3, 2/3)]

TESTS:

sage: R = FormalSums(QQ)
sage: loads(dumps(R)) == R
True
sage: a = R(2/3) + R(-5/7); a
-5/7 + 2/3
sage: loads(dumps(a)) == a
True
class sage.structure.formal_sum.FormalSum(x, parent=Abelian Group of all Formal Finite Sums over Integer Ring, check=True, reduce=True)

Bases: sage.structure.element.ModuleElement

A formal sum over a ring.

reduce()

EXAMPLES:

sage: a = FormalSum([(-2,3), (2,3)], reduce=False); a
-2*3 + 2*3
sage: a.reduce()
sage: a
0
sage.structure.formal_sum.FormalSums(R=Integer Ring)

Return the R-module of finite formal sums with coefficients in R.

INPUT:
R – a ring (default: ZZ)

EXAMPLES:

sage: FormalSums()
Abelian Group of all Formal Finite Sums over Integer Ring
sage: FormalSums(ZZ[sqrt(2)])
Abelian Group of all Formal Finite Sums over Order in Number Field in sqrt2 with defining polynomial x^2 - 2
sage: FormalSums(GF(9,'a'))
Abelian Group of all Formal Finite Sums over Finite Field in a of size 3^2
class sage.structure.formal_sum.FormalSums_generic(base=Integer Ring)

Bases: sage.modules.module.Module

base_extend(R)

EXAMPLES:

sage: FormalSums(ZZ).base_extend(GF(7))
Abelian Group of all Formal Finite Sums over Finite Field of size 7
get_action_impl(other, op, self_is_left)

EXAMPLES:

sage: A = FormalSums(RR).get_action(RR); A     # indirect doctest
Right scalar multiplication by Real Field with 53 bits of precision on Abelian Group of all Formal Finite Sums over Real Field with 53 bits of precision

sage: A = FormalSums(ZZ).get_action(QQ); A
Right scalar multiplication by Rational Field on Abelian Group of all Formal Finite Sums over Rational Field
with precomposition on left by Call morphism:
  From: Abelian Group of all Formal Finite Sums over Integer Ring
  To:   Abelian Group of all Formal Finite Sums over Rational Field
sage: A = FormalSums(QQ).get_action(ZZ); A
Right scalar multiplication by Integer Ring on Abelian Group of all Formal Finite Sums over Rational Field

Previous topic

Base class for parent objects with generators.

Next topic

Factorizations

This Page