Repository navigation
fix(symbolic): compare two-variable inequalities by region instead of at x = 1 (PIE-1419) - #86
Merged
Merged
Conversation
…eric checks (PIE-443) areNumericallyEquivalent gave every variable the same integer values, so it could not tell x^2 from y^2. Use fixed-seed pseudo-random values, different for each variable, and add a check for equations that are constant (or variable-factor) multiples of each other.
…valent (PIE-443) Two-variable equations were compared by solving for y at x = 1. For equations that are not linear in y both solutions were undefined, and undefined === undefined scored any such pair as equivalent. Compare equations in two variables numerically instead, guard the inequality path against undefined solutions, and fall back to the numeric check for one-variable equations that are neither linear nor quadratic.
…PIE-443) Targets are the correct answers of items E217532, E232686, E234938 and E234162; ne cases are the changes reported in the ticket.
… at x = 1 (PIE-1419)
…ic equation checks (PIE-443)
…ariable (PIE-1419)
… expressions (PIE-443)
|
🎉 This PR is included in version 1.4.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
What
In symbolic mode, a wrong answer to an inequality in two variables was scored correct whenever it gave the same boundary value as the correct answer at x = 1. For example,
y>2x+1vsy>3xwas scored correct because both give y > 3 at x = 1. Two-variable inequalities are now equivalent only when they describe the same region.Jira: https://illuminate.atlassian.net/browse/PIE-1419
Depends on #77 (PIE-443). This PR reuses
areEquationsNumericallyEquivalentand the sample points from #77, so until #77 merges, this PR's diff againstdevelopalso shows #77's commits. Review and merge #77 first. This PR's own changes are in the(PIE-1419)commits.Why it happened
compareEquationsinsrc/symbolic/compare-equations.tsturned a two-variable inequality into a one-variable one by setting x = 1, then compared the y values. One value of x can't show that two inequalities describe the same region. Inequalities that aren't linear in y, such asx^2+y^2\le4, couldn't be solved this way at all. #77 replaced this check for equations and left inequalities on it to keep that change scoped.Change
compare-equations.ts: two-variable inequalities now use the same numeric check as two-variable equations, withpositiveOnly: true, even-power variable factors only, and no numerator comparison.F ⋚ 0/G ⋚ 0form. They're equivalent whenF/Gis the same positive constant at every sample point.y>x^2≡\frac{y}{x^2}>1andy>x≡x^2y>x^3. An odd power such asx, or clearing a variable denominator, can change sign across the region, so neither is allowed (utils.tsfilters the variable factors to even powers whenpositiveOnlyis set).index.tsonly sendslarger/largerorlargerEq/largerEqpairs. So a positive ratio means the same region.xandyare told apart.The x = 1 block is removed because nothing reaches it anymore, and so is its only helper,
setXToOne. One-variable inequalities still use the existing solve and sign-flip check.Scoring impact
All of these are compared with #77. On
develop, the first group is also scored correct.Answers that were previously scored correct and are now scored incorrect:
y>2x+1vsy>3xandy>x+23x-2y\ge6vs3x-2y\le6(the same line with the region on the opposite side)xoryis positive, for exampley>xvs\frac{y}{x}>1,\frac{1}{y}<\frac{1}{x},y\cdot y>x\cdot yand(y-x)x>0,xy>1vsy>\frac{1}{x}, andy>x^2vs\frac{y}{x}>xandxy>x^3y>\left|x\right|vsy>xx^2+y^2\le4vsx^2+y^2\le5. fix(symbolic): stop accepting wrong answers to two-variable equations with powers (PIE-443) #77 scores this correct when it's called on its own, which is how scoring runs. In the full fixture suite it already comes out incorrect, so it isn't in the count below.y>xvs(y-x)(x^2+1)>0and\frac{y-x}{x^2+1}>0, andy>x^2+1vs\frac{y}{x^2+1}>1. The ratio isn't constant, so the check can't tell these apart from different regions. Students are unlikely to write them.Answers that were previously scored incorrect and are now scored correct:
x^2+y^2\le4vs2x^2+2y^2\le8andx^2+y^2-4\le0,y^2>xvs2y^2>2x, and(y-x)^2>0vs(x-y)^2>0Answers whose scoring is unchanged:
\frac{y-1}{2}>x, are also still accepted.y>2x+1vs2x+1\le y.y>xvsx^2y>x^3andy>2x+1vsx^2y>x^2(2x+1).2-way-inequalities-with-variables.tsand3-way-inequalities-with-variables.ts.Tests
src/fixtures/latex-equal/symbolic/PIE-1419.ts, +3positiveOnlyunit tests insrc/__tests__/utils.spec.ts, −8setXToOneunit tests removed with the helper).tsc --noEmitis clean.src/symbolicfrom fix(symbolic): stop accepting wrong answers to two-variable equations with powers (PIE-443) #77, exactly the 14 changed-answer cases fail in the full suite.Follow-up
docs/) to be regenerated after merge.y^3>x^3and2^y>2^x. They describe the same region, but the ratio isn't constant. Students are unlikely to write these. Ondevelop,2^y>2^xwas accepted only because every variable got the same sample values.y>\sqrt{x}\cdot\sqrt{x}vsy>xis still accepted, even though the first only coversx ≥ 0. This was already the case ondevelopand fix(symbolic): stop accepting wrong answers to two-variable equations with powers (PIE-443) #77.y>2xvsy>2x+0.0000000001. Differences of 1e-8 or more are caught.develop,x^2+y^2\le4vsx^2+y^2\le5is scored correct when called on its own, but incorrect inside the full fixture suite, which points to state leaking between calls. This PR scores it incorrect either way.