Welcome to symba’s documentation!

Note

If object is not listed in documentation it should be considered as implementation detail that can change and should not be relied upon.

base module

symba.base.sqrt(argument: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]
Returns square root of the argument:

exact if it is a perfect square, symbolic instead.

>>> sqrt(0) == 0
True
>>> sqrt(1) == 1
True
>>> square_root_of_two = sqrt(2)
>>> square_root_of_two ** 2 == 2
True
>>> 1 < square_root_of_two < 2
True
class symba.base.Expression[source]
abstract property degree

Returns degree of the expression.

abstract property is_finite

Checks if the expression is finite.

abstract evaluate(sqrt_evaluator: Optional[Callable[[SupportsFloat], numbers.Real]] = None)numbers.Real[source]

Evaluates the expression.

abstract extract_common_denominator()Tuple[int, symba.core.expression.Expression][source]

Returns a pair of the common denominator of the expression and the rest of the expression.

abstract extract_common_numerator()Tuple[int, symba.core.expression.Expression][source]

Returns a pair of the common numerator of the expression and the rest of the expression.

abstract inverse()symba.core.expression.Expression[source]

Returns the expression inverted.

abstract is_positive()bool[source]

Checks if the expression is positive.

abstract lower_bound()numbers.Real[source]

Returns lower bound of the expression.

abstract perfect_sqrt()symba.core.expression.Expression[source]

Returns perfect square root part of the expression.

abstract significant_digits_count()int[source]

Returns significant digits count of the expression.

abstract square()symba.core.expression.Expression[source]

Returns the expression squared.

abstract upper_bound()numbers.Real[source]

Returns upper bound of the expression.

__abs__()symba.core.expression.Expression[source]

Returns an absolute value of the expression.

abstract __add__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns sum of the expression with the other.

__ceil__()int[source]

Return the ceiling of the expression.

__floor__()int[source]

Return the floor of the expression.

__floordiv__(other: Union[numbers.Real, symba.core.expression.Expression])int[source]

Returns quotient of the division of the expression by the other.

__ge__(other: Union[numbers.Real, symba.core.expression.Expression])bool[source]

Checks if the expression is greater than or equal to the other.

__gt__(other: Union[numbers.Real, symba.core.expression.Expression])bool[source]

Checks if the expression is greater than the other.

abstract __hash__()int[source]

Returns hash value of the expression.

__le__(other: Union[numbers.Real, symba.core.expression.Expression])bool[source]

Checks if the expression is lower than or equal to the other.

__lt__(other: Union[numbers.Real, symba.core.expression.Expression])bool[source]

Checks if the expression is lower than the other.

__mod__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns remainder of the division of the expression by the other.

abstract __mul__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns multiplication of the expression with the other.

abstract __neg__()symba.core.expression.Expression[source]

Returns the expression negated.

__pos__()symba.core.expression.Expression[source]

Returns the expression positive.

__pow__(exponent: int)symba.core.expression.Expression[source]

Returns the expression raised to the given exponent.

abstract __radd__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns sum of the other with the expression.

__rfloordiv__(other: Union[numbers.Real, symba.core.expression.Expression])int[source]

Returns quotient of the division of the other by the expression.

__rmod__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns remainder of the division of the other by the expression.

abstract __rmul__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns multiplication of the other with the expression.

__round__(precision: Optional[int] = None)symba.core.expression.Expression[source]

Returns the expression rounded to the given precision.

__rsub__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns difference of the other with the expression.

__rtruediv__(other: numbers.Real)symba.core.expression.Expression[source]

Returns division of the other by the expression.

__sub__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns difference of the expression with the other.

__truediv__(other: Union[numbers.Real, symba.core.expression.Expression])symba.core.expression.Expression[source]

Returns division of the expression by the other.

__trunc__()int[source]

Returns the expression truncated to a nearest-to-zero integer.

symba.base.get_sqrt_evaluator()Callable[[SupportsFloat], numbers.Real][source]

Returns current square root evaluator.

symba.base.set_sqrt_evaluator(evaluator: Callable[[SupportsFloat], numbers.Real])None[source]

Sets square root evaluator.