From fcc1f605535081bfcee74dc1a154839e10b807ef Mon Sep 17 00:00:00 2001 From: Christian Bauer Date: Mon, 29 Jan 2001 21:43:45 +0000 Subject: [PATCH] added a check that expand(x^((a+b)^2-a^2-b^2-2*a*b)) -> 1 --- check/exam_misc.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/check/exam_misc.cpp b/check/exam_misc.cpp index f8a52578..3b2ff8ea 100644 --- a/check/exam_misc.cpp +++ b/check/exam_misc.cpp @@ -72,6 +72,23 @@ static unsigned exam_expand_subs2(void) return result; } +static unsigned exam_expand_power(void) +{ + unsigned result = 0; + symbol x("x"), a("a"), b("b"); + ex e; + + e = pow(x,pow(a+b,2)-pow(a,2)-pow(b,2)-a*b*2).expand(); + + if (e != 1) { + clog << "e = pow(x,pow(a+b,2)-pow(a,2)-pow(b,2)-a*b*2).expand(); erroneously returned " + << e << " instead of simplifying to 1." << endl; + ++result; + } + + return result; +} + unsigned exam_misc(void) { unsigned result = 0; @@ -81,6 +98,7 @@ unsigned exam_misc(void) result += exam_expand_subs(); cout << '.' << flush; result += exam_expand_subs2(); cout << '.' << flush; + result += exam_expand_power(); cout << '.' << flush; if (!result) { cout << " passed " << endl; -- 2.44.0