bertini.symbolics

The symbolic expression system for building polynomial systems – a FLAT namespace.

Renamed from function_tree (the underlying C++ module keeps that name). Everything lives directly here, with no .symbol / .operator / .root sub-levels:

plus variables(), sqrt(), and VariableGroup.

class bertini.symbolics.AbstractNode

Bases: instance

Raises an exception This class cannot be instantiated from Python

__init__()

Raises an exception This class cannot be instantiated from Python

degree((AbstractNode)self) int :

compute the algebraic degree of node in a function tree, with respect to all variables. returns one integer. negative is non-algebraic.

degree( (AbstractNode)self, (bertini._pybertini.function_tree.symbol.Variable)var) -> int :

compute the algebraic degree of node in a function tree, with respect to a particular variable. returns one integer. negative is non-algebraic.

degree( (AbstractNode)self, (bertini._pybertini.container.VariableGroup)vars) -> int :

compute the algebraic degree of node in a function tree, with respect to a variable group. returns one integer. negative is non-algebraic.

differentiate((AbstractNode)self) AbstractNode :

differentiate a node. is with respect to all variables. you get a Jacobian back, which represents derivatives wrt all variables simultaneously.

differentiate( (AbstractNode)arg1, (bertini._pybertini.function_tree.symbol.Variable)self) -> AbstractNode :

differentiate a node with respect to one variable. You get a regular old Node in a Function Tree back.

eval()
object eval(tuple args, dict kwds) :

evaluate this expression at a point given as keyword arguments naming the variables, e.g. f.eval(x=2, y=5). No System is needed. Evaluation is in multiple precision at the current default precision; native Python floats carry only float64 of information. Every variable of the expression must be supplied a value, and every keyword must name a variable of the expression.

homogenized((AbstractNode)self, (bertini._pybertini.container.VariableGroup)vars, (bertini._pybertini.function_tree.symbol.Variable)homvar) AbstractNode :

Return a NEW homogenized copy of this function tree (non-mutating) with respect to the variables in vars using the homogenizing variable homvar. Degree-deficient terms are padded with powers of homvar so all terms share the same degree. The original tree is left untouched.

is_homogeneous((AbstractNode)self) bool :

test if this Node is homogeneous with respect to all Variables.

is_homogeneous( (AbstractNode)self, (bertini._pybertini.function_tree.symbol.Variable)var) -> bool :

test if this Node is homogeneous with respect to Variable var.

is_homogeneous( (AbstractNode)self, (bertini._pybertini.container.VariableGroup)vars) -> bool :

test if this Node is homogeneous with respect to the Variables in vars.

is_polynomial((AbstractNode)self) bool :

test if this Node is polynomial with respect to all Variables.

is_polynomial( (AbstractNode)self, (bertini._pybertini.function_tree.symbol.Variable)var) -> bool :

test if this Node is polynomial with respect to Variable var.

is_polynomial( (AbstractNode)self, (bertini._pybertini.container.VariableGroup)vars) -> bool :

test if this Node is polynomial with respect to Variables vars.

multidegree((AbstractNode)self, (bertini._pybertini.container.VariableGroup)vars) bertini._pybertini.container.ListOfInt :

Compute an integer vector containing the degrees with respect to the variables in vars. Negative entries indicate non-polynomiality

variables((AbstractNode)self) bertini._pybertini.container.VariableGroup :

The distinct variables appearing in this expression, sorted by name.

class bertini.symbolics.MonomialOrder

Bases: enum

the monomial order used to canonically order Sum/Mult operands

GrevLex = bertini._pybertini.function_tree.MonomialOrder.GrevLex
Lex = bertini._pybertini.function_tree.MonomialOrder.Lex
RevLex = bertini._pybertini.function_tree.MonomialOrder.RevLex
names = {'GrevLex': bertini._pybertini.function_tree.MonomialOrder.GrevLex, 'Lex': bertini._pybertini.function_tree.MonomialOrder.Lex, 'RevLex': bertini._pybertini.function_tree.MonomialOrder.RevLex}
values = {0: bertini._pybertini.function_tree.MonomialOrder.Lex, 1: bertini._pybertini.function_tree.MonomialOrder.RevLex, 2: bertini._pybertini.function_tree.MonomialOrder.GrevLex}
bertini.symbolics.acos((AbstractNode)arg1) AbstractNode :

the symbolic arccosine operator

bertini.symbolics.asin((AbstractNode)arg1) AbstractNode :

the symbolic arcsine operator

bertini.symbolics.atan((AbstractNode)arg1) AbstractNode :

the symbolic arctangent operator

bertini.symbolics.canonicalize() bool :

whether Sum/Mult operands are canonically ordered, so x+y and y+x are one node

canonicalize( (bool)on) -> None :

enable/disable canonical operand ordering, session-global (the per-expression opt-out)

bertini.symbolics.cos((AbstractNode)arg1) AbstractNode :

the symbolic cosine operator

bertini.symbolics.exp((AbstractNode)arg1) AbstractNode :

the symbolic exponential operator

bertini.symbolics.gather_variables((bertini._pybertini.container.ListOfNode)functions) bertini._pybertini.container.VariableGroup :

Return the distinct variables appearing in a list of functions, ordered alphabetically by name.

gather_variables( (AbstractNode)node) -> bertini._pybertini.container.VariableGroup :

Return the distinct variables appearing in an expression, ordered alphabetically by name.

bertini.symbolics.log((AbstractNode)arg1) AbstractNode :

the symbolic natural log operator

bertini.symbolics.monomial_order() MonomialOrder :

the current monomial order used for canonicalization

monomial_order( (MonomialOrder)order) -> None :

set the monomial order (Lex/RevLex/GrevLex), session-global

bertini.symbolics.sin((AbstractNode)arg1) AbstractNode :

the symbolic sine operator

bertini.symbolics.tan((AbstractNode)arg1) AbstractNode :

the symbolic tangent operator

class bertini.symbolics.Complex((object)arg1, (bertini._pybertini.multiprec.real_mp)arg2, (bertini._pybertini.multiprec.real_mp)arg3) object

Bases: AbstractNumber

A complex-number literal node in an expression tree. Holds a full arbitrary-precision complex value (a real literal is just zero imaginary part). Build it as Complex(real) or Complex(real, imag) from exact strings/multiprec values; prefer Integer or Rational for exact non-irrational coefficients.

__init__( (object)arg1, (str)arg2) -> object

__init__( (object)arg1, (str)arg2, (str)arg3) -> object

__init__( (object)arg1, (bertini._pybertini.multiprec.complex_mp)arg2) -> object

__init__((object)arg1, (bertini._pybertini.multiprec.real_mp)arg2, (bertini._pybertini.multiprec.real_mp)arg3) object

__init__( (object)arg1, (str)arg2) -> object

__init__( (object)arg1, (str)arg2, (str)arg3) -> object

__init__( (object)arg1, (bertini._pybertini.multiprec.complex_mp)arg2) -> object

value((Complex)arg1) bertini._pybertini.multiprec.complex_mp :

the literal value this node represents, at its stored (highest) precision

class bertini.symbolics.E((object)arg1) object

Bases: AbstractNumber

__init__((object)arg1) object
property name

None( (bertini._pybertini.function_tree.symbol.E)arg1) -> str

class bertini.symbolics.Integer((object)arg1, (int)arg2) object

Bases: AbstractNumber

__init__( (object)arg1, (bertini._pybertini.multiprec.int_mp)arg2) -> object

__init__( (object)arg1, (str)arg2) -> object

__init__((object)arg1, (int)arg2) object

__init__( (object)arg1, (bertini._pybertini.multiprec.int_mp)arg2) -> object

__init__( (object)arg1, (str)arg2) -> object

value((Integer)arg1) bertini._pybertini.multiprec.int_mp :

the literal value this node represents

class bertini.symbolics.Pi((object)arg1) object

Bases: AbstractNumber

__init__((object)arg1) object
property name

None( (bertini._pybertini.function_tree.symbol.Pi)arg1) -> str

class bertini.symbolics.Rational((object)arg1, (int)arg2) object

Bases: AbstractNumber

__init__( (object)arg1, (int)arg2, (int)arg3, (int)arg4, (int)arg5) -> object

__init__( (object)arg1, (str)arg2) -> object

__init__( (object)arg1, (str)arg2, (str)arg3) -> object

__init__( (object)arg1, (bertini._pybertini.multiprec.rational_mp)arg2, (bertini._pybertini.multiprec.rational_mp)arg3) -> object

__init__((object)arg1, (int)arg2) object

__init__( (object)arg1, (int)arg2, (int)arg3, (int)arg4, (int)arg5) -> object

__init__( (object)arg1, (str)arg2) -> object

__init__( (object)arg1, (str)arg2, (str)arg3) -> object

__init__( (object)arg1, (bertini._pybertini.multiprec.rational_mp)arg2, (bertini._pybertini.multiprec.rational_mp)arg3) -> object

static rand() Rational
static rand_real() Rational
value_imag((Rational)arg1) bertini._pybertini.multiprec.rational_mp :

the imaginary part of the literal value this node represents

value_real((Rational)arg1) bertini._pybertini.multiprec.rational_mp :

the real part of the literal value this node represents

class bertini.symbolics.Variable((object)arg1, (str)arg2) object

Bases: AbstractNamedSymbol

__init__((object)arg1, (str)arg2) object
class bertini.symbolics.ArcCos((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Trig, Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.ArcSin((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Trig, Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.ArcTan((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Trig, Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Cos((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Trig, Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Exp((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.IntegerPower((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (int)arg3) object

Bases: Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (int)arg3) object
property exponent

None( (bertini._pybertini.function_tree.operator.IntegerPower)arg1) -> int

class bertini.symbolics.Log((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Mult((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bertini._pybertini.function_tree.AbstractNode)arg3) object

Bases: Nary

__init__( (object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bool)arg3, (bertini._pybertini.function_tree.AbstractNode)arg4, (bool)arg5) -> object

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bertini._pybertini.function_tree.AbstractNode)arg3) object

__init__( (object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bool)arg3, (bertini._pybertini.function_tree.AbstractNode)arg4, (bool)arg5) -> object

add_operand((Mult)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bool)arg3) None
mult_or_div((Mult)self, (int)index) bool :

the operation for the operand at the given index: True if multiplied, False if divided

class bertini.symbolics.Nary

Bases: AbstractOp

Raises an exception This class cannot be instantiated from Python

__init__()

Raises an exception This class cannot be instantiated from Python

add_operand((Nary)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) None
first_operand((Nary)arg1) bertini._pybertini.function_tree.AbstractNode
num_operands((Nary)arg1) int
operand((Nary)self, (int)index) bertini._pybertini.function_tree.AbstractNode :

get the operand at the given index; see num_operands

class bertini.symbolics.Negate((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Power((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bertini._pybertini.function_tree.AbstractNode)arg3) object

Bases: AbstractOp

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bertini._pybertini.function_tree.AbstractNode)arg3) object
get_base((Power)self) bertini._pybertini.function_tree.AbstractNode :

get the base node

get_exponent((Power)self) bertini._pybertini.function_tree.AbstractNode :

get the exponent node

set_base((Power)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) None
set_exponent((Power)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) None
class bertini.symbolics.Sin((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Trig, Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Sqrt((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Sum((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bertini._pybertini.function_tree.AbstractNode)arg3) object

Bases: Nary

__init__( (object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bool)arg3, (bertini._pybertini.function_tree.AbstractNode)arg4, (bool)arg5) -> object

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bertini._pybertini.function_tree.AbstractNode)arg3) object

__init__( (object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bool)arg3, (bertini._pybertini.function_tree.AbstractNode)arg4, (bool)arg5) -> object

add_operand((Sum)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (bool)arg3) None
sign((Sum)self, (int)index) bool :

the sign of the operand at the given index: True if added, False if subtracted

class bertini.symbolics.Tan((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object

Bases: Trig, Unary

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) object
class bertini.symbolics.Trig

Bases: AbstractNode

Raises an exception This class cannot be instantiated from Python

__init__()

Raises an exception This class cannot be instantiated from Python

class bertini.symbolics.Unary

Bases: AbstractOp

Raises an exception This class cannot be instantiated from Python

__init__()

Raises an exception This class cannot be instantiated from Python

operand((Unary)arg1) bertini._pybertini.function_tree.AbstractNode
set_operand((Unary)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2) None
class bertini.symbolics.NamedExpression((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (str)arg3) object

Bases: AbstractNamedSymbol

__init__((object)arg1, (bertini._pybertini.function_tree.AbstractNode)arg2, (str)arg3) object
root((NamedExpression)self) bertini._pybertini.function_tree.AbstractNode :

the defining expression this name stands for

class bertini.symbolics.VariableGroup((object)arg1)

Bases: instance

__init__( (object)arg1, (object)arg2) -> object

__init__( (object)arg1, (str)arg2, (int)arg3) -> object :

VariableGroup(name, count): the variables name0, name1, …, name{count-1}

__init__((object)arg1) None

__init__( (object)arg1, (object)arg2) -> object

__init__( (object)arg1, (str)arg2, (int)arg3) -> object :

VariableGroup(name, count): the variables name0, name1, …, name{count-1}

append((VariableGroup)arg1, (object)arg2) None
extend((VariableGroup)arg1, (object)arg2) None
bertini.symbolics.variables(base, indices, fmt='{base}{index}')[source]

Make a list of integer-indexed Variables.

base    -- name prefix, e.g. 'x'
indices -- an int n (shorthand for range(n)) or any iterable of ints
fmt     -- str.format template using {base} and {index};
           default '{base}{index}' gives x0, x1, x2, ...

Returns a list[Variable]. Wrap in a VariableGroup if desired:

pb.VariableGroup(pb.variables('x', 5))
bertini.symbolics.sqrt(x)[source]

Symbolic square-root operator.