I have a user interface problem that I hope isn't only solved by adding yet another option for authors to understand.

Student types a mathematical expression. We allow implicit multiplication, so `xy` is interpreted as `x*y`.
What to do about `pi`? Is it `p*i` or `π`?

I guess most of the time, you'd expect it to be interpreted as π. But you might be doing something with complex numbers, and `p*i` is really what you meant.
I suppose rendering π would at least give you a hint to add the * symbol

· · Web · 8 · 1 · 0

@christianp I think the problem is the implicit multiplication.

It's better to be clear. I may, however, be biased since I'm working on a symbolic maths UI (based on Maxima). In it, you are explicit in what you type, such as: a*%pi, and it will render as: a π. Of course, it's reasonable to allow a user to type a*π as well, although it's not supported at the moment.

I believe that trying to be "clever" when parsing maths will lead to problems, because no matter how you choose to parse it, a user will always end up being unsure as to exactly how their input was parsed, which is definitely not what you want when doing maths.

Here's an example of my UI:

@loke I agree less ambiguity is better, but this is an assessment system used by maths students at all levels. For years I avoided this implicit multiplication, but it trips up so many students, even if you tell them to always insert multiplication symbols.
My position is that we should do our best to be generous interpreting what the student means.

@christianp I would build the assessment into the system itself. In other words, it would show the student how the system has parsed the input. That way it doesn't matter what format you require, since they will see the result displayed before submitting anyway.

@loke that's what it does. The problem is that from a student's perspective, 'xy' could either be a single variable with a two-letter name, or the product of 'x' and 'y'. We even display long variable names in a different font, but they don't pick up on that.
We also show multiplication symbols in the preview, but if you're not expecting to see one, you won't notice it's missing.

@christianp that a goodbye point. In my application, the difference would be how xy is displayed vs x y, which might not be be readily obvious to a beginner.

There is only reliable solution I can think of is to completely disallow multi character symbols and also display the multiplication signs.

@loke yep, that's what my solution looked like until this morning. But is 'pi' a multi-character symbol?

@christianp it would be parsed as pi, yes and displayed as such. It wouldn't be confused with p*i since that would be displayed with the multiplication symbol.

@loke For that to work depends on the student's idea of when symbols should be shown matching the system's.
This is a really frustrating problem, trying to work around users who can't (and shouldn't, for the purpose of the assessment) be relied on to apply the rules you give them

@christianp my idea was based on the fact that two characters will never be displayed next to each other without an operation in between.

@loke yes, but you need the student to understand that. Teachers omit multiplication symbols in their notes or handwritten work, so students do the same.


"Implicit multiplication" sounds like a very bad construct, a shorthand open to misinterpretation throughout a mathematical system where it is allowed.


Too much like "It is given..." for those of us to whom it has not been clearly understood.

@christianp If you render a preview on the fly, I would expect it to be clear. Especially if the student can see the `x*y` syntax somewhere (help text etc.). I would consider `p*i` about as logical interpretation as `s*i*n`.

@petrilaarne what about the letter ξ, transliterated as 'xi'? I reckon `x*i` is the most common interpretation of that.

The system already renders a preview of the interpreted expression on the fly, but students either ignore it or misinterpret it - if they're not expecting a multiplication symbol, they don't notice it's missing.

@christianp That’s an excellent counterexample. I agree that `x*i` could reasonably come up. A few years ago, I wouldn’t even have associated the word ”xi” with the letter ξ (the Finnish transliteration being ”ksii”).

I would require the implicit multiplication to be separated by a space. This would also improve the readability of expressions and you could distinguish "3 pi" from "3 p i"

@christianp With disturbing frequency, I have to disambiguate my LaTeX through the addition of spacing characters. Additional parenthetical or operation symbols would be non-standard in these cases, yet the standard notation is definitively ambiguous. But at least it renders \(\pi\) ... When forced to communicate in a TeX-lacking environment, I am moving toward just typing in the TeX anyway and trusting the receiving party to find some way of reading it.

@kimreece yes, adding space to TeX markup is almost always a good idea.

@christianp maybe call out the ambiguity in the preview, say, a notification/warning when input is ambiguous (e.g., render ξ and add "did you mean x*i?" )

@christianp relatedly, is \(\sin x\) a trig function applied to a variable, or the product of four different variables? ;)

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!