RationalPolynomial

RationalPolynomial()

A Symbolica rational polynomial.

Methods

Name Description
apart Compute the partial fraction decomposition in x.
denominator Get the denominator.
derivative Take a derivative in x.
gcd Compute the greatest common divisor (GCD) of two rational polynomials.
get_var_list Get the list of variables in the internal ordering of the polynomial.
numerator Get the numerator.
parse Parse a rational polynomial from a string.
to_expression Convert the polynomial to an expression.
to_finite_field Convert the coefficients of the rational polynomial to a finite field with prime prime.
to_latex Convert the rational polynomial into a LaTeX string.

apart

RationalPolynomial.apart(x)

Compute the partial fraction decomposition in x.

Examples

>>> from symbolica import Expression
>>> x = Expression.symbol('x')
>>> p = Expression.parse('1/((x+y)*(x^2+x*y+1)(x+1))').to_rational_polynomial()
>>> for pp in p.apart(x):
>>>     print(pp)

denominator

RationalPolynomial.denominator()

Get the denominator.

derivative

RationalPolynomial.derivative(x)

Take a derivative in x.

Examples

>>> from symbolica import Expression
>>> x = Expression.symbol('x')
>>> p = Expression.parse('1/((x+y)*(x^2+x*y+1)(x+1))').to_rational_polynomial()
>>> print(p.derivative(x))

gcd

RationalPolynomial.gcd(rhs)

Compute the greatest common divisor (GCD) of two rational polynomials.

get_var_list

RationalPolynomial.get_var_list()

Get the list of variables in the internal ordering of the polynomial.

numerator

RationalPolynomial.numerator()

Get the numerator.

parse

RationalPolynomial.parse(_cls, input, vars)

Parse a rational polynomial from a string. The list of all the variables must be provided.

If this requirements is too strict, use Expression.to_polynomial() instead.

Examples

>>> e = RationalPolynomial.parse('(3/4*x^2+y+y*4)/(1+x)', ['x', 'y'])

Raises

Type Description
ValueError If the input is not a valid Symbolica rational polynomial.

to_expression

RationalPolynomial.to_expression()

Convert the polynomial to an expression.

Examples

>>> from symbolica import Expression
>>> e = Expression.parse('(x*y+2*x+x^2)/(x^7+y+1)')
>>> p = e.to_polynomial()
>>> print((e - p.to_expression()).expand())

to_finite_field

RationalPolynomial.to_finite_field(prime)

Convert the coefficients of the rational polynomial to a finite field with prime prime.

to_latex

RationalPolynomial.to_latex()

Convert the rational polynomial into a LaTeX string.