0

What should be the best response from a calculator or computer algebra system when it can't evaluate given expression ? Some examples:

LibreCalc         : =😁÷🤣  → Err:501
Ubuntu Calculator : 😁÷🤣   → Malformed expression
Wolfram Alpha     : 😁÷🤣   → Wolfram|Alpha doesn't understand your query
Maxima            : maxima --very-quiet -r '😁÷🤣;' → 😁÷🤣

Now my personal impressions about these responses:

Err:501

Some cryptic error code which doesn't say anything about issue at hand. You must then read manuals to understand what's going on. And from version-to-version this error code can change.

Malformed expression

This tries to argue that my given expression is somewhat BAD. But you can't be sure about it. It may be bad OR simply calculator engine don't have an internal knowledge how to compute that expression. So this response is too categorical.

Wolfram|Alpha doesn't understand your query

This is much, much better. Shows that computation engine can't parse requested expression. Of course if I would get such answer from a human, I would ask "What you don't understand exactly ?" So still not 100% right.

😁÷🤣

I choose this as a winner. This program tries to be mathematically correct in each and every way. Every man on the world knows that expression is equal to itself : x=x. So if you can't evaluate given expression - at least output to the user original expression. It respects my feeling
"Do something !". And it does (at least what it can)


What do you think ?

  • 1
    I, for one, have no idea what you mean by this: "Every man on the world knows that expression is equal to itself : x=x". Your assumption there is already wrong. – Matthijs Mali Oct 23 '18 at 8:13
  • You can output original (un-evaluated) expression as an answer. And technically it would be a valid answer, albeit not calculated – Agnius Vasiliauskas Oct 23 '18 at 8:43
  • Ah, now I see what you mean there. It could make sense to an advanced calculator user. You could enrich the question with some details about the typical user of your system? – Matthijs Mali Oct 23 '18 at 8:50
4

A calculator is a tool intended to be useful for humans. If the human entered an expression that the calculator couldn't process, they deserve to have a response that indicates what went wrong. This will hopefully give them the information they need to help them fix their input and get a more useful response.

Just returning the expression that you were unable to evaluate might be smugly "correct" on some mathematical level, but it certainly does not make the tool more useful to the humans using it.

  • Agree to some level. But problem is with "what went wrong". Not in all cases is easy to say what was wrong. In practice almost reverse situation happens - what exactly went wrong is unclear or there may be multiple/alternative wrong causes - in that case what program should choose ? This is too ambiguous, so program in principle can't help the user to fix their input. – Agnius Vasiliauskas Oct 24 '18 at 9:04
  • 1
    @AgniusVasiliauskas Not a problem at all with "what went wrong". A programm code inside calculator knows what's gong wrong because it detected and processed error. So I agree with Franchesca that more useful will be error description. If there are several possible errors simply start with the first one. This is not too ambiguous, but driving user step by step to correct expression. If calculator can't interpret correct expression due to it's functional restrictions, user will be informed about this and choose another one. – Serg Oct 24 '18 at 9:23
  • @AgniusVasiliauskas One cannot always explain what exactly went wrong. I have implemented expression parsing a number of times, and in practice I have found that we usually have a long expression that was mostly parse-able, but with one section that didn't make sense. Often just highlighting which part of the expression we couldn't parse is sufficient for the user to notice the typo they made. – Franchesca Oct 24 '18 at 9:23
  • +1 And even if you cannot give useful information about what is wrong with an expression, the fact that you get an error message will make the user stop and think. One problem with just echoing an expression that cannot be computed (either because it's un-parseable, or because it's too complex), is that -- it seems to me -- to be too easy for the user not to notice it wasn't fully understood (especially if this were in a script of operations). – TripeHound Oct 24 '18 at 15:20
0

I would vote for "Malformed expression" as it is the most recognizable and familiar expression amongst the options. System feedback should always use natural language and phrases. This way you not only decrease the learning curve but also discard confusion.

I have almost nominal knowledge of Programming/Dev, out of all the options, the only one clear enough was 2nd.

In fact, I would make it simpler and natural like "Oops, this is tough!". Probably not go with that exact sentence but something on similar lines.

Hope this helps!

  • Imagine user tries expression !45, maybe instead of showing "Malformed expression" is better to show Available options : 45! ,... ? – Agnius Vasiliauskas Oct 24 '18 at 9:09
  • Yes, that would be useful. Maybe you can also frame it as how Google does it "Did you mean : 45! I would still show a message stating that there has been an error in the user input though. – Yash Sonwaney Oct 24 '18 at 10:32
  • 2
    @AgniusVasiliauskas By all means build in knowledge of "obvious" typos, if you can... but to do that well probably requires scanning an enormous amount of malformed input (something Google can easily do; most others less so). And even then, some typos won't suggest "obvious" corrections. Start with a clear error ("Malformed expression") and potentially augment it when easy to do. (Noting, that many users will quickly spot their own errors when brought to their attention). – TripeHound Oct 24 '18 at 15:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.