bertini.operators

The whole math vocabulary in one namespace – symbols and numbers alike.

One import gives you functions that work on everything: a symbolic Variable/expression, a multiprecision number, a numpy array of them, or a plain python number:

from bertini.operators import *

f = sin(x) + Pi*y - E          # symbolic       (x, y Variables -> an expression)
v = sin(real_mp('0.5'))        # numeric        (full precision)
m = abs(solutions[0])          # numpy arrays   (multiprecision dtypes included)
t = arg(complex_mp(1, 1))      # components     (arg/real/imag/conj)

Dispatch is by argument: a function-tree node builds a symbolic node; everything else takes the numeric path (multiprecision scalars and mp-dtype numpy arrays go through the native precision-preserving loops; python numbers and float arrays are plain numpy). You never have to remember whether a name lives in bertini.multiprec or at the top level – it is here.

The functions with no symbolic counterpart (abs, arg, real, imag, conj, round, sum, norm, is_real, and the hyperbolics) raise a clear TypeError when handed a symbolic expression.

abs, round, and sum shadow the python builtins within your namespace when you star-import this module – that is the point (they fall back to builtin behavior on plain python input), but it is opt-in: from bertini import * never shadows builtins.

bertini.operators.sin(x)

Sine.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.cos(x)

Cosine.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.tan(x)

Tangent.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.asin(x)

Arcsine.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.acos(x)

Arccosine.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.atan(x)

Arctangent.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.sinh(x, *args, **kwargs)

Hyperbolic sine.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.cosh(x, *args, **kwargs)

Hyperbolic cosine.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.tanh(x, *args, **kwargs)

Hyperbolic tangent.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.asinh(x, *args, **kwargs)

Hyperbolic arcsine.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.acosh(x, *args, **kwargs)

Hyperbolic arccosine.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.atanh(x, *args, **kwargs)

Hyperbolic arctangent.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.exp(x)

Exponential, base e.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.log(x)

Natural logarithm.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.sqrt(x)

Square root.

Polymorphic: builds a symbolic node for a function-tree argument, computes numerically (precision-preserving, numpy containers included) for everything else.

bertini.operators.abs(x, *args, **kwargs)

Magnitude(s), as real_mp for mp input.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.arg(x, *args, **kwargs)

Argument(s) (angle from 0), as real_mp. Beware the branch cut.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.real(x, *args, **kwargs)

Real part(s), as real_mp for mp input.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.imag(x, *args, **kwargs)

Imaginary part(s), as real_mp for mp input.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.conj(x, *args, **kwargs)

Complex conjugate(s).

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.round(x, *args, **kwargs)

Round to N DECIMAL digits, staying mp-native.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.sum(x, *args, **kwargs)

Sum of a collection, staying mp-native.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.norm(x, *args, **kwargs)

Euclidean (2-)norm, as real_mp.

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.

bertini.operators.is_real(x, *args, **kwargs)

Is every coordinate real (abs(imag) < tol)?

Numeric: multiprecision scalars, numpy arrays (mp dtypes included), lists, and plain python numbers.