public void solve(String calculation) {
        double solution;
        try {
            calculation = replacePi(calculation);
            calculation = replaceLogs(calculation);

            ScriptEngineManager manager = new ScriptEngineManager();
            ScriptEngine engine = manager.getEngineByName("js");
            solution = (Double) engine.eval(calculation);
        } catch (Exception e) {
            gui.displayError("Syntax Error!");
            return;
        }
        gui.getOutput().setText(Double.toString(solution));
    }