ntqr.algebra

Functions for algebraic manipulation of axiom expressions.

@author: Andrés Corrada-Emmanuel.

Functions

extract_coefficents(→ collections.abc.Sequence[int])

Extract vars coefficients from expr.

extract_constant(→ int)

Extracts the constant term in 'expr.'

Module Contents

ntqr.algebra.extract_coefficents(expr: sympy.UnevaluatedExpr, vars: collections.abc.Sequence[sympy.Symbol]) collections.abc.Sequence[int]

Extract vars coefficients from expr.

Assumes that ‘expr’ is a linear equation.

Parameters:
  • expr (sympy.UnevaluatedExpr) – Linear expression.

  • vars (Sequence[sympy.Symbol]) – Variables for which we have their coefficient in expr.

Returns:

The integer coefficients, following the same order as ‘vars’.

Return type:

Sequence[int]

ntqr.algebra.extract_constant(expr: sympy.UnevaluatedExpr) int

Extracts the constant term in ‘expr.’

Returns the value of the constant term in expr.

Parameters:

expr (sympy.UnevaluatedExpr) – An algebraic expression.

Returns:

The integer value of the constant term.

Return type:

int