Skip to content
Snippets Groups Projects
Commit d2920828 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Fix to issue #1066: replace #pm#, where possible, in ATAlgEquiv.

parent d2b276dd
Branches
No related tags found
No related merge requests found
......@@ -1173,6 +1173,9 @@ ATAlgEquivNouns(SA,SB) := block([simp:true, ret, newret, SAN, SBN],
ATAlgEquivfun(SA, SB) := block([SApoly, SBpoly, keepfloat, RawMark, FeedBack, AnswerNote, ret],
Validity:true, RawMark:false, FeedBack:"", AnswerNote:"",
keepfloat:true,
/* Reduce the number of different operators, where possible. */
if ev(is(count_op(SA,STACKpmOPT)=1), simp) then SA:pm_replace(SA),
if ev(is(count_op(SB,STACKpmOPT)=1), simp) then SB:pm_replace(SB),
/* Are we dealing with strings? */
if stringp(SB) then
if stringp(SA)#true then
......
......@@ -329,6 +329,10 @@ class stack_answertest_test_data {
array('AlgEquiv', '', '4*x^2-71*x+220 = 0 or 14*x^2-91*x+140 = 0',
'x = 5/2 or x = 4 or x=4 or x = 55/4', 1, 'ATEquation_sides', ''),
array('AlgEquiv', '', 'x^2=4', 'x=2 or x=-2', 1, 'ATEquation_ratio', ''),
array('AlgEquiv', '', 'x^2=4', 'x=2 nounor x=-2', 1, 'ATEquation_ratio', ''),
array('AlgEquiv', '', 'x^2-5*x+6=0', 'x=2 nounor x=3', 1, 'ATEquation_sides', ''),
array('AlgEquiv', '', 'x^2-5*x+6=0', 'x=(5 #pm# sqrt(25-24))/2', 1, 'ATEquation_sides', ''),
array('AlgEquiv', '', 'x^2-5*x+6=0', 'x=(5 #pm# sqrt(25-23))/2', 0, 'ATEquation_default', ''),
array('AlgEquiv', '', 'a^3*b^3=0', 'a=0 or b=0', 0, 'ATEquation_default', ''),
array('AlgEquiv', '', 'a^3*b^3=0', 'a*b=0', 0, 'ATEquation_default', ''),
array('AlgEquiv', '', '(x-y)*(x+y)=0', 'x^2=y^2', 1, 'ATEquation_ratio', ''),
......@@ -574,7 +578,8 @@ class stack_answertest_test_data {
array('AlgEquiv', '', 'A and (B or C)', 'A and (B or C)', 1, 'ATLogic_True.', ''),
array('AlgEquiv', '', '(A and B) or (A and C)', 'A and (B or C)', 1, 'ATLogic_True.', ''),
array('AlgEquiv', '', '-(b#pm#sqrt(b^2-4*a*c))', '-b#pm#sqrt(b^2-4*a*c)', 1, 'ATLogic_True.', ''),
array('AlgEquiv', '', 'x=-b#pm#c^2', 'x=c^2-b or x=-c^2-b', 1, 'ATLogic_True.', ''),
array('AlgEquiv', '', 'x=-b#pm#c^2', 'x=c^2-b or x=-c^2-b', 1, 'ATEquation_sides', ''),
array('AlgEquiv', '', 'x=b#pm#c^2', 'x=c^2-b or x=-c^2-b', 0, 'ATEquation_default', ''),
array('AlgEquiv', '', 'x#pm#a = y#pm#b', 'x#pm#a = y#pm#b', 1, 'ATEquation_sides', ''),
array('AlgEquiv', '', 'x#pm#a = y#pm#b', 'x#pm#a = y#pm#c', 0, 'ATEquation_lhs_notrhs', ''),
array('AlgEquiv', '', 'not(A) and not(B)', 'not(A or B)', 1, 'ATLogic_True.', ''),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment