From: Christian Bauer Date: Mon, 29 Jan 2001 21:43:45 +0000 (+0000) Subject: added a check that expand(x^((a+b)^2-a^2-b^2-2*a*b)) -> 1 X-Git-Tag: release_0-7-1~12 X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=commitdiff_plain;h=fcc1f605535081bfcee74dc1a154839e10b807ef added a check that expand(x^((a+b)^2-a^2-b^2-2*a*b)) -> 1 --- 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;