Skip to content

Shouldn't √3x parse as √3 * x? It doesn't. #27641

Closed
@pablosanjose

Description

@pablosanjose

I would argue that juxtaposition of constants and variables, such as 3x should be generalized to work with literals such as √3, so that √3x parses as (√3) * x instead of the current √(3x). It might be me, but the current parsing is very surprising, specially with longer variable names, 2variable1 + √3variable2. A bug in a pattern like this had me staring at a single line of code for ~10 minutes, before I figured what was wrong!

Without "vincula", such as in √3̅x̅, this is obviously ambiguous, but I think that the current parsing is actually inconsistent with the parsing of 3x^2, which correctly parses according to the standard math convention, first the power, then the multiplication.

A suggestion in slack by Chris Peel was to change the parsing and additionally teach the parser to understand \sqrt{3x}, so that we can still have the present behaviour, but with a vincula rendered using unicode. That part might be much more tricky, however.

Metadata

Metadata

Assignees

Labels

parserLanguage parsing and surface syntax

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions