Follow-up functional & documentation changes to math expressions #4254
Open
Description
#2173 introduced the minimal necessary support for numeric expressions, algebraic expressions, and math equations. It did, however, not include a bunch of suggestions that came toward the end of the project from other members of the community. While these changes weren't deemed blocking for the broader feature, they're still important and thus are being cataloged below to ensure they get completed:
- Treat partial functions like 'sqr' as 'sqr' rather than failing due to expecting 'sqrt'. Documentation, tests, and errors will need to be updated to account for this. Also, the change needs to be done in a way that doesn't break the LL(1) nature of the tokenizer or parser.
- Add support for abs function
- Update grammar to be clearer per comments in technical specification, and update corresponding functions & comments in the implementation
- Add test cases for complex implicit multiplication that goes with exponents, such as
-2x^2zy^3
(per this comment) - Verify implicit multiplication behavior for integer-based exponents in algebraic expressions & update tests/documentation as needed (comment)
- Verify that '+2' triggers the correct error, or fix it to (comment)
- Add counts for the errors indicating something is missing before/after a binary operator (comment)
- Add support for coefficient changes in equivalence checking that would yield the same result (to ensure cases like
1/4y=x
being equivalent toy=4x
hold true), and add/update tests & documentation as needed - Add the following new classifier test cases (create a named version of the test matrix before making all of these changes to make it easier to review the changes; it might be worth doing this before any test matrix changes for all of these items):
-
(x^2+2x+1)/(x+1)
(for parity with(x^2+2x+1)/(x-1)
) - Test cases for fifth powers, sixth powers, powers of -2, -3, fractional powers, etc.
-
2 * 2 * 3 * 3
matching2 * 2 * 3^2
- Failing case for
y-1=0
vs.1-y=0
- Failing case for
4^2
vs2^4
- Test case wherein the answer is
1-(2-0)
and the rule input(1-2)-0
- Test cases where the numeric constant is on the leftside of a polynomial (reference comment for context)
- Add sampling equivalence checking for cases when polynomial computation doesn't work & fix/add tests/documentation as needed (sample case:
sqrt(x)
matches for exact equality & trivial manipulations, but not for equivalence due to the polynomial restriction). Ditto for cases when polynomial division results in a remainder. Note: we need to find an algorithm or technique for doing this reliably. - Make sure that the case outlined in this comment is specifically supported
- Test to verify that
a * a * a
anda^3
trivially match, buta^(1+2
should not matcha*a*a
- Similar to above,
(2a)^3
is not trivially equivalent to2a*(a+a)*2a
, and ditto for(a+b)^3
and(a+b)*(b+a)*(a+b)
-
- Update accessibility string generation to generate terms for 'x^2' (squared) and 'x^3 (cubed)
- Double check that string generation support for accessibility correctly implements the spec (per open comments)
- Update the error handling & wording for 'number after ' per this comment
- Ensure the extra unary symbols error provides the correct symbol (per this comment)
- Ensure uses of quotations are consistent in error (comment)
- Possibly remove the error for using an invalid function (comment)
- Add support for rearranging equation's LHS/RHS for the matches with trivial manipulations classifier, and update documentation/tests as needed (comment)
- Fix implicit multiplication cases for negative unary (though I'm not 100% what this is at the moment; this was copied from my personal tracking document for the project)
- Changes to a11y readout for implicit multiplication + new tests (similarly, this was copied from my project plan so some work may be needed to figure out what actual work, if any, is needed here)
- Resolve all open comments in the technical specification
- Resolve all pending approvals for the math expressions PRD & accessibility document
- File an issue detailing the plans (or at least goals) of adding support for localizing math expression readouts
- File an issue detailing the requirements for a custom math keyboard (at least at a high-level)
- Write & implement a test matrix for error cases
- Fix In one of the options for an exploration, the denominator is not seen clearly #4333
- Update polynomial comparison to fall back to samples if polynomial conversion fails (need to match web's behavior here)
- Update comparable operation to fall back to null instead of default if it fails (otherwise a false positive can occur)
- Update trivial manipulation classifiers to fall back to matches-exactly behavior if comparable operation conversion fails
Metadata
Assignees
Labels
Low perceived user impact (e.g. edge cases).Indicates that an issue is too large and should be broken into smaller chunks.The means to find the solution is clear, but it isn't at good-first-issue level yet.Temporary label for Ben to keep track of issues he's triaged.End user-perceivable enhancements.