SUMMARY When you draw a cartesian plot with a function which ends with a binary operator, KmPlot recognizes no syntax error, but draws a different function instead. Example: “f(x) = x” works fine, but “g(x) = x +” draws another function. See screenshot. https://imgur.com/jQmhl26.png STEPS TO REPRODUCE 1. Enter “f(x) = x” and “g(x) = x +” OBSERVED RESULT Two different graphs. Every time you try this, you get another second graph; appears to be random. EXPECTED RESULT One graph and one syntax error SOFTWARE/OS VERSIONS Linux/KDE Plasma: Xfce desktop, don’t know how to look up version, sorry. KDE Frameworks Version: 5.68 Qt Version: 5.14.1 ADDITIONAL INFORMATION I consider this as a bug. + as unary operator has no common meaning known to me, and in the KmPlot function reference it is defined as binary operator. If there is a purpose, I am curious which. This appears to affect all binary operators, not just +.
There is no purpose, it is a bug. "x+" is evaluated as "x+pi".
So we need to fix it! :) Where can I go to fix it? (When I have my development system back, which will take some weeks. :( )
I did some more tests, and can say that x+ is usually not x+pi. It appears that binary operators at the end just affect the last evaluated expression, ignoring any precedence. Examples: x+ is x+a, where a appears to be the last evaluated expression of the previous function, or pi for the first function. x²+ and (x²) are x²+2 (x³)+ is x³+3 e²+ is e²+2 x³/ is x³/3 0²+ is 2 etc.
That's not Mathematica that can translate any possible gibberish, imho. Anyway, should be relatively easy to fix in parser.cpp.
For the future triagers, the reporter wants a complete parser, not a workaround in fixExpression (parser.cpp) function: https://phabricator.kde.org/D29418