Repository navigation
expression-parsing: read sum(expr) without limits as an unevaluated sum - #2
Merged
Merged
Conversation
…s, refine LaTeX handling, enhance symbol alias logic, and add regression tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a regression found in the compareExpressions refactor sweep. With
elementary_functionson,sum(...)with no limits was rewritten to SymPy'ssummation, which needs limits. Every submission to an affected question then got an HTTP 500, correct answers included.Changes
sum(expr)now parses toUNEVALUATED_SUM(expr), an undefined functionsum. Two sums are equal when their summands simplify equal. Nothing is factored out, because the index is unknown.sum(f, (k, a, b))andsummation(...)still evaluate.sum(...)is a sum even when the task definessumas a symbol code or alias. A baresumstays the task's symbol (ALWAYS_FUNCTIONSinsymbol_tables.py).sympy_to_latexprints it as\sum{\left(… \right)}.Behaviour change: old cE only graded these questions because, by accident, it read
sumas a plain symbol. Report case3e65804enow grades incorrect, because its reference answer hassum(1/(2k+1)) * sin(...), withsinoutside the sum. That reference answer needs fixing.Testing: new
TestSumWithoutLimitsintests/test_regressions.py. The expression_parsing, criteria and units suites pass, and ruff and mypy are clean. I also ran the report's repro cases through the cE refactor branch with this package: no 500s.🤖 Generated with Claude Code