Module pypol :: Class AlgebraicFraction
[show private | hide private]
[frames | no frames]

Type AlgebraicFraction

object --+
         |
        AlgebraicFraction


Provide object representing an algebraic fraction given numerator and denominator, that could be Monomial or Polynomial instances or even numbers.

Example:
>>> a = Polynomial([Monomial(2, x=2), Monomial(-3, z=1)])
>>> b = Polynomial([Monomial(4, y=4), Monomial(1, z=3)])
>>> print a/b
2
2 x - 3 z
---------
   4   3
4 y + z

Method Summary
  __init__(self, numer, denom)
Build the algebraic fraction given numerator and denominator and check if the numerator and the denominator values are right.
  __div__(self, my_AF)
  __eq__(self, my_AF)
  __mul__(self, my_AF)
  __rdiv__(self, my_AF)
Division with swapped operands.
  __repr__(self)
eval(repr(algebraicFractionInstance)) should be equal to algebraicFractionInstance.
  __rmul__(self, my_AF)
Multiplication with swapped operands.
  __str__(self)
Transform the object in a human-readable string.
  __truediv__(self, my_AF)
Division with __future__.division.
  check_second_term(wrapped)
Check if the second term of an operation is an AlgebraicFraction
  eval(self, **unknowns)
Given the unknowns of the fraction, return the result of the function myAlgebraicFraction(x, y, ...)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Method Details

__init__(self, numer, denom=1)
(Constructor)

Build the algebraic fraction given numerator and denominator and check if the numerator and the denominator values are right.

Example:
>>> a = AlgebraicFraction(Monomial(2, x=2), Monomial(3, y=2))
>>> print a.numer
2
2 x

>>> print a.denom
2
3 y
Overrides:
__builtin__.object.__init__

__rdiv__(self, my_AF)

Division with swapped operands.

See also method __div__.

__repr__(self)
(Representation operator)

eval(repr(algebraicFractionInstance)) should be equal to algebraicFractionInstance.

Example:
>>> numer = Polynomial([Monomial(2, x=2), Monomial(-3, z=1)])
>>> denom = Polynomial([Monomial(4, y=4), Monomial(1, z=3)])
>>> a1 = AlgebraicFraction(numer, denom)
>>> a1 == eval(repr(a1))
True
Overrides:
__builtin__.object.__repr__

__rmul__(self, my_AF)

Multiplication with swapped operands.

__str__(self)
(Informal representation operator)

Transform the object in a human-readable string.

Example:
>>> a = Polynomial([Monomial(2, x=2)])
>>> b = Polynomial([Monomial(4, y=4), Monomial(1, z=3)])
>>> print a/b
2
2 x
---------
   4   3
4 y + z
Overrides:
__builtin__.object.__str__

__truediv__(self, my_AF)

Division with __future__.division.

See also method __div__.

check_second_term(wrapped)

Check if the second term of an operation is an AlgebraicFraction

eval(self, **unknowns)

Given the unknowns of the fraction, return the result of the function myAlgebraicFraction(x, y, ...)

Example:
>>> a = Polynomial([Monomial(2, x=2)])
>>> b = Polynomial([Monomial(4, y=4), Monomial(1, z=3)])
>>> c = AlgebraicFraction(a, b)
>>> print c.eval(x=3, y=2, z=1)
18/65
Ignore exceeding arguments.

Generated by Epydoc 2.1 on Fri Aug 10 15:00:04 2007 http://epydoc.sf.net