From 79383e999a49c7fc001e10d70c8175cb1931d0a6 Mon Sep 17 00:00:00 2001 From: Richard Kreckel Date: Sun, 18 Sep 2022 23:04:26 +0200 Subject: [PATCH] Fix checks for sqrfree_parfrac(). --- check/exam_sqrfree.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/check/exam_sqrfree.cpp b/check/exam_sqrfree.cpp index 3e94ed67..b9fc82a9 100644 --- a/check/exam_sqrfree.cpp +++ b/check/exam_sqrfree.cpp @@ -202,15 +202,15 @@ unsigned exam_sqrfree_parfrac() symbol x("x"); // (expression, number of terms after partial fraction decomposition) vector> exams = { - {ex("(x - 1) / (x*(x^2 + 2))", lst{x}), 2}, + {ex("(x - 1) / (x^2*(x^2 + 2))", lst{x}), 3}, {ex("(1 - x^10) / x", lst{x}), 2}, {ex("(2*x^3 + x + 3) / ((x^2 + 1)^2)", lst{x}), 2}, - {ex("1 / (x * (x+1) * (x+2))", lst{x}), 3}, - {ex("(x*x + 3*x - 1) / (x^2*(x^2 + 2)^2)", lst{x}), 4}, + {ex("1 / (x * (x+1)^2 * (x+2)^3)", lst{x}), 6}, + {ex("(x*x + 3*x - 1) / (x^2*(x^2 + 2)^3)", lst{x}), 5}, {ex("(1 - x^10) / (x + 2)", lst{x}), 11}, {ex("(1 - x + 3*x^2) / (x^3 * (2+x)^2)", lst{x}), 5}, {ex("(1 - x) / (x^4 * (x - 2)^3)", lst{x}), 6}, - {ex("(1 - 2*x + x^9) / (x^5 * (1 - x + x^2)^5)", lst{x}), 12} + {ex("(1 - 2*x + x^9) / (x^5 * (1 - x + x^2)^6)", lst{x}), 11} }; unsigned result = 0; @@ -219,7 +219,8 @@ unsigned exam_sqrfree_parfrac() for (auto e: exams) { ex e1 = e.first; ex e2 = sqrfree_parfrac(e1, x); - if (e2.nops() != e.second && + if (e2.nops() != e.second || + !is_a(e2) || !normal(e1-e2).is_zero()) { clog << "sqrfree_parfrac(" << e1 << ", " << x << ") erroneously returned " << e2 << endl; -- 2.49.0