diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml index 5a758b5..6315e3d 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Setting/ExpressionEditor.qml @@ -433,7 +433,7 @@ Item { itemSelected: parent.itemSelected categoryItems: Parsing.CONSTANTS_LIST autocompleteGenerator: (item) => {return { - 'text': item, 'annotation': '', + 'text': item, 'annotation': Parsing.CONSTANTS[item], 'autocomplete': item + " ", 'cursorFinalOffset': 0 }} baseText: parent.visible ? parent.currentToken.value : "" diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js index ae689e8..4bd6ccd 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/expr-eval.js @@ -27,7 +27,7 @@ var ADDITIONAL_VARCHARS = [ "ₜ","¹","²","³","⁴","⁵","⁶", "⁷","⁸","⁹","⁰","₁","₂","₃", "₄","₅","₆","₇","₈","₉","₀", - "∞" + "∞","π" ] function Instruction(type, value) { diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/common.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/common.js index 297887b..7eeeb6b 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/common.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/math/common.js @@ -55,6 +55,8 @@ parser.functions.integral = function(a, b, f, variable) { } parser.functions.derivative = function(f, variable, x) { + if(f == null || variable == null || x == null) + throw EvalError("Usage: derivative(, , )") f = parser.parse(f).toJSFunction(variable, currentVars) return (f(x+DERIVATION_PRECISION/2)-f(x-DERIVATION_PRECISION/2))/DERIVATION_PRECISION } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js index ddc3bdd..92baff9 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/parsing/reference.js @@ -95,23 +95,5 @@ const FUNCTIONS = { 'derivative': () => 0, } const FUNCTIONS_LIST = Object.keys(FUNCTIONS); -// TODO: Complete -const DERIVATIVES = { - "abs": "abs(<1>)/<1>", - "acos": "-derivate(<1>)/sqrt(1-(<1>)^2)", - "acosh": "derivate(<1>)/sqrt((<1>)^2-1)", - "asin": "derivate(<1>)/sqrt(1-(<1>)^2)", - "asinh": "derivate(<1>)/sqrt((<1>)^2+1)", - "atan": "derivate(<1>)/(1+(<1>)^2)", - "atan2": "", -} -const INTEGRALS = { - "abs": "integrate(<1>)*sign(<1>)", - "acos": "", - "acosh": "", - "asin": "", - "asinh": "", - "atan": "", - "atan2": "", -} +