Tool
Enhanced Calculator
This calculator will work with better capabilities and since it's using sympy there no security issues, making it very good for privacy and more complex math problems.
Tool ID
enhanced_calculator
Creator
@rais
Downloads
612+

Tool Content
python
import sympy as sp

class Tools:
    def __init__(self):
        pass

    def calculator(self, equation: str) -> str:
        """
        Calculate the result of an equation safely.
        :param equation: The equation to calculate.
        :return: The result of the equation.
        """
        try:
            # Parse the equation using sympy
            expr = sp.sympify(equation)
            result = expr.evalf()
            return f"{equation} = {result}"
        except (sp.SympifyError, ValueError) as e:
            print(e)
            return "Invalid equation"

# Example usage
tools = Tools()
result = tools.calculator("3 + 5 * (2 - 8)")
print(result)  # Output: 3 + 5 * (2 - 8) = -25.0000000000000