Source code for rl_equation_solver.utilities.operators

"""Custom operator functions"""
from operator import pow


[docs]def div(a, b): """Define divide operator""" return a / b
[docs]def root(a, b): """Define root function""" return pow(a, pow(b, -1))
# pylint: disable=unused-argument
[docs]def sqrt(a, b): """Define sqrt function""" return a ** 0.5
# pylint: disable=unused-argument
[docs]def square(a, b): """Define square function""" return a * a
[docs]def fraction(a): """Return float from fraction""" if "/" in a: a, b = a.split("/") return int(a) / int(b) else: return float(a)