]> www.ginac.de Git - ginac.git/commitdiff
- Duh, we had some style discussion again...
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Mon, 14 Aug 2000 19:44:58 +0000 (19:44 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Mon, 14 Aug 2000 19:44:58 +0000 (19:44 +0000)
28 files changed:
check/check_inifcns.cpp
check/check_lsolve.cpp
check/check_matrices.cpp
check/check_numeric.cpp
check/checks.cpp
check/checks.h
check/exam_differentiation.cpp
check/exam_inifcns.cpp
check/exam_lsolve.cpp
check/exam_matrices.cpp
check/exam_misc.cpp
check/exam_noncommut.cpp
check/exam_normalization.cpp
check/exam_numeric.cpp
check/exam_paranoia.cpp
check/exam_polygcd.cpp
check/exam_powerlaws.cpp
check/exam_pseries.cpp
check/exams.cpp
check/time_dennyfliegner.cpp
check/time_gammaseries.cpp
check/time_lw_C.cpp
check/time_lw_G.cpp
check/time_lw_IJKL.cpp
check/time_lw_M1.cpp
check/time_toeplitz.cpp
check/time_vandermonde.cpp
check/times.cpp

index bec2ed97c602eb0bc509fce9b96d82c313d20f31..f17ef5d68bb785c1678bc52cdd0392955e3abac0 100644 (file)
@@ -39,7 +39,7 @@ static unsigned inifcns_check_sin(void)
        if (errorflag) {
                // we don't count each of those errors
                clog << "sin(n*Pi) with integer n does not always return exact 0"
-                        << endl;
+                    << endl;
                ++result;
        }
        
@@ -47,13 +47,13 @@ static unsigned inifcns_check_sin(void)
        errorflag = false;
        for (int n=-10; n<=10; ++n) {
                if (!sin((n+numeric(1,2))*Pi).eval().info(info_flags::integer) ||
-                       !(sin((n+numeric(1,2))*Pi).eval() == numeric(1) ||
-                         sin((n+numeric(1,2))*Pi).eval() == numeric(-1)))
+                   !(sin((n+numeric(1,2))*Pi).eval() == numeric(1) ||
+                     sin((n+numeric(1,2))*Pi).eval() == numeric(-1)))
                        errorflag = true;
        }
        if (errorflag) {
                clog << "sin((n+1/2)*Pi) with integer n does not always return exact {+|-}1"
-                        << endl;
+                    << endl;
                ++result;
        }
        
@@ -68,7 +68,7 @@ static unsigned inifcns_check_sin(void)
                argument = n*Pi/60;
                if (abs(sin(evalf(argument))-evalf(sin(argument)))>epsilon) {
                        clog << "sin(" << argument << ") returns "
-                                << sin(argument) << endl;
+                            << sin(argument) << endl;
                        errorflag = true;
                }
        }
@@ -88,12 +88,12 @@ static unsigned inifcns_check_cos(void)
        errorflag = false;
        for (int n=-10; n<=10; ++n) {
                if (cos((n+numeric(1,2))*Pi).eval() != numeric(0) ||
-                       !cos((n+numeric(1,2))*Pi).eval().info(info_flags::integer))
+                   !cos((n+numeric(1,2))*Pi).eval().info(info_flags::integer))
                        errorflag = true;
        }
        if (errorflag) {
                clog << "cos((n+1/2)*Pi) with integer n does not always return exact 0"
-                        << endl;
+                    << endl;
                ++result;
        }
        
@@ -101,13 +101,13 @@ static unsigned inifcns_check_cos(void)
        errorflag = false;
        for (int n=-10; n<=10; ++n) {
                if (!cos(n*Pi).eval().info(info_flags::integer) ||
-                       !(cos(n*Pi).eval() == numeric(1) ||
-                         cos(n*Pi).eval() == numeric(-1)))
+                   !(cos(n*Pi).eval() == numeric(1) ||
+                     cos(n*Pi).eval() == numeric(-1)))
                        errorflag = true;
        }
        if (errorflag) {
                clog << "cos(n*Pi) with integer n does not always return exact {+|-}1"
-                        << endl;
+                    << endl;
                ++result;
        }
        
@@ -122,7 +122,7 @@ static unsigned inifcns_check_cos(void)
                argument = n*Pi/60;
                if (abs(cos(evalf(argument))-evalf(cos(argument)))>epsilon) {
                        clog << "cos(" << argument << ") returns "
-                                << cos(argument) << endl;
+                            << cos(argument) << endl;
                        errorflag = true;
                }
        }
@@ -151,7 +151,7 @@ static unsigned inifcns_check_tan(void)
                argument = n*Pi/60;
                if (abs(tan(evalf(argument))-evalf(tan(argument)))>epsilon) {
                        clog << "tan(" << argument << ") returns "
-                                << tan(argument) << endl;
+                            << tan(argument) << endl;
                        errorflag = true;
                }
        }
@@ -176,10 +176,10 @@ static unsigned inifcns_check_Li2(void)
        numeric epsilon(double(1e-16));
        for (int n=0; n<200; ++n) {
                argument = numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)
-                                + numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)*I;
+                        + numeric(20.0*rand()/(RAND_MAX+1.0)-10.0)*I;
                if (abs(Li2(pow(argument,2))-2*Li2(argument)-2*Li2(-argument)) > epsilon) {
                        cout << "Li2(z) at z==" << argument
-                                << " failed to satisfy Li2(z^2)==2*(Li2(z)+Li2(-z))" << endl;
+                            << " failed to satisfy Li2(z^2)==2*(Li2(z)+Li2(-z))" << endl;
                        errorflag = true;
                }
        }
index 4a84a13c13b54555fd359ec2b63ed6bd632c94e4..80bfdc1283ec4863b4eb5a2e74fa2b8f468707f7 100644 (file)
@@ -82,9 +82,9 @@ static unsigned check_matrix_solve(unsigned m, unsigned n, unsigned p,
        }
        if (errorflag) {
                clog << "Our solve method claims that A*X==B, with matrices" << endl
-                        << "A == " << A << endl
-                        << "X == " << sol << endl
-                        << "B == " << B << endl;
+                    << "A == " << A << endl
+                    << "X == " << sol << endl
+                    << "B == " << B << endl;
                return 1;
        }
        
@@ -146,7 +146,7 @@ static unsigned check_inifcns_lsolve(unsigned n)
                        if (errorflag) {
                                ++result;
                                clog << "solution of the system " << eqns << " for " << vars
-                                        << " erroneously returned " << sol << endl;
+                                    << " erroneously returned " << sol << endl;
                        }
                }
        }
index 4a768b90c3406d44dff0ac3a329ca77c4fb24744..ae37315496143a5b9afbfbd62fc287bd6526b595 100644 (file)
@@ -40,8 +40,8 @@ static unsigned integdom_matrix_determinants(void)
                        A.set(size-1,c,A(0,c)-A(size-2,c));
                if (!A.determinant().is_zero()) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "was not found to vanish!" << endl;
+                            << endl << A << endl
+                            << "was not found to vanish!" << endl;
                        ++result;
                }
        }
@@ -75,8 +75,8 @@ static unsigned rational_matrix_determinants(void)
                        A.set(size-1,co,A(0,co)-A(size-2,co));
                if (!A.determinant().is_zero()) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "was not found to vanish!" << endl;
+                            << endl << A << endl
+                            << "was not found to vanish!" << endl;
                        ++result;
                }
        }
@@ -109,8 +109,8 @@ static unsigned funny_matrix_determinants(void)
                        A.set(ro,size-1,A(ro,0)-A(ro,size-2));
                if (!A.determinant().is_zero()) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "was not found to vanish!" << endl;
+                            << endl << A << endl
+                            << "was not found to vanish!" << endl;
                        ++result;
                }
        }
@@ -143,12 +143,12 @@ static unsigned compare_matrix_determinants(void)
                        (det_bareiss-det_laplace).normal() != 0 ||
                        (det_divfree-det_laplace).normal() != 0) {
                        clog << "Determinant of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "is inconsistent between different algorithms:" << endl
-                                << "Gauss elimination:   " << det_gauss << endl
-                                << "Minor elimination:   " << det_laplace << endl
-                                << "Division-free elim.: " << det_divfree << endl
-                                << "Fraction-free elim.: " << det_bareiss << endl;
+                            << endl << A << endl
+                            << "is inconsistent between different algorithms:" << endl
+                            << "Gauss elimination:   " << det_gauss << endl
+                            << "Minor elimination:   " << det_laplace << endl
+                            << "Division-free elim.: " << det_divfree << endl
+                            << "Fraction-free elim.: " << det_bareiss << endl;
                        ++result;
                }
        }
@@ -183,9 +183,9 @@ static unsigned symbolic_matrix_inverse(void)
                                        ok = false;
                if (!ok) {
                        clog << "Inverse of " << size << "x" << size << " matrix "
-                                << endl << A << endl
-                                << "erroneously returned: "
-                                << endl << B << endl;
+                            << endl << A << endl
+                            << "erroneously returned: "
+                            << endl << B << endl;
                        ++result;
                }
        }
index 36a0d1cbf54b02008f4f5f2fec4d4b22e86fe2b9..ac2b60eaa927ef1d31d9834bbdc6c3df886f9eee 100644 (file)
@@ -47,7 +47,7 @@ static unsigned check_numeric1(void)
                numeric res = p/q;
                if (res != z) {
                        clog << z << " erroneously transformed into " 
-                                << p << "/" << q << " by numer() and denom()" << endl;
+                            << p << "/" << q << " by numer() and denom()" << endl;
                        errorflag = true;
                }
        }
@@ -81,14 +81,14 @@ static unsigned check_numeric2(void)
                        // test the result:
                        if (is_ex_of_type(radical,numeric)) {
                                clog << "(" << num << "/" << den << ")^(" << nm
-                                        << ") should have been a product, instead it's "
-                                        << radical << endl;
+                                    << ") should have been a product, instead it's "
+                                    << radical << endl;
                                errorflag = true;
                        }
                        numeric ratio = ex_to_numeric(evalf(radical))/floating;
                        if (ratio>1.0001 && ratio<0.9999) {
                                clog << "(" << num << "/" << den << ")^(" << nm
-                                        << ") erroneously evaluated to " << radical;
+                                    << ") erroneously evaluated to " << radical;
                                errorflag = true;
                        }
                }
index 87782fccc64a16754c8d21f1d5a09f2f0045991b..85c56ba2fc6efca85650b7f137935c42fcc00994 100644 (file)
@@ -72,7 +72,7 @@ int main()
                        cout << "(" << result << " individual failures)" << endl;
                }
                cout << "please check checks.out against check.ref for more details."
-                        << endl << "happy debugging!" << endl;
+                    << endl << "happy debugging!" << endl;
        }
        
        return result;
index e585eab15238ef35695afe6ab08bc72b15761399..48c8e0fd6b185aa08042a6d5fa8f2f32c6ed8941 100644 (file)
@@ -35,10 +35,11 @@ using namespace GiNaC;
 
 // prototypes for the expression generating functions in:
 const ex dense_univariate_poly(const symbol & x, unsigned degree);
-const ex dense_bivariate_poly(const symbol & x1, const symbol & x2, unsigned degree);
+const ex dense_bivariate_poly(const symbol & x1, const symbol & x2,
+                              unsigned degree);
 const ex sparse_tree(const symbol & x, const symbol & y, const symbol & z,
-                                        int level,
-                                        bool trig = false, bool rational = true, bool complex = false);
+                     int level,
+                     bool trig = false, bool rational = true, bool complex = false);
 
 // prototypes for all individual checks should be unsigned fcn():
 unsigned check_numeric();
index 13e54711f089945d2a68000fab95811d26791a7b..d2015822d308a25e305e8265ae65e098700fd9d7 100644 (file)
@@ -43,7 +43,7 @@ static unsigned check_diff(const ex &e, const symbol &x,
                        clog << nth << "th ";
                }
                clog << "derivative of " << e << " by " << x << " returned "
-                        << ed << " instead of " << d << endl;
+                    << ed << " instead of " << d << endl;
                clog << "returned:" << endl;
                ed.printtree(clog);
                clog << endl << "instead of" << endl;
@@ -101,15 +101,15 @@ static unsigned exam_differentiation2(void)
        result += check_diff(e, x, d);
        
        d = 2*b*pow(cos(e1),2)*pow(2*x*y + a, 2) + 4*b*y*e2*cos(e1)
-               - 2*b*pow(e2,2)*pow(2*x*y + a, 2) - y*e2*pow(2*x*y + a, 2)
-               + 2*pow(y,2)*cos(e1);
+           - 2*b*pow(e2,2)*pow(2*x*y + a, 2) - y*e2*pow(2*x*y + a, 2)
+           + 2*pow(y,2)*cos(e1);
        result += check_diff(e, x, d, 2);
        
        d = 2*b*e2*cos(e1)*pow(x, 2) + e2 + y*cos(e1)*pow(x, 2);
        result += check_diff(e, y, d);
 
        d = 2*b*pow(cos(e1),2)*pow(x,4) - 2*b*pow(e2,2)*pow(x,4)
-               + 2*cos(e1)*pow(x,2) - y*e2*pow(x,4);
+           + 2*cos(e1)*pow(x,2) - y*e2*pow(x,4);
        result += check_diff(e, y, d, 2);
        
        // construct expression e to be diff'ed:
@@ -120,15 +120,15 @@ static unsigned exam_differentiation2(void)
        result += check_diff(e, x, d);
        
        d = 2*b*pow(sin(e1),2)*pow(2*y*x + a,2) - 4*b*e2*sin(e1)*y 
-               - 2*b*pow(e2,2)*pow(2*y*x + a,2) - y*e2*pow(2*y*x + a,2)
-               - 2*pow(y,2)*sin(e1);
+           - 2*b*pow(e2,2)*pow(2*y*x + a,2) - y*e2*pow(2*y*x + a,2)
+           - 2*pow(y,2)*sin(e1);
        result += check_diff(e, x, d, 2);
        
        d = -2*b*e2*sin(e1)*pow(x,2) + e2 - y*sin(e1)*pow(x, 2);
        result += check_diff(e, y, d);
        
        d = -2*b*pow(e2,2)*pow(x,4) + 2*b*pow(sin(e1),2)*pow(x,4)
-               - 2*sin(e1)*pow(x,2) - y*e2*pow(x,4);
+           - 2*sin(e1)*pow(x,2) - y*e2*pow(x,4);
        result += check_diff(e, y, d, 2);
 
        return result;
@@ -150,7 +150,7 @@ static unsigned exam_differentiation3(void)
        result += check_diff(e, x, d);
        
        d = 4*b*pow(e2,2)*pow(2*y*x + a,2) + 4*b*pow(e2,2)*y
-               + 2*pow(y,2)*e2 + y*e2*pow(2*y*x + a,2);
+           + 2*pow(y,2)*e2 + y*e2*pow(2*y*x + a,2);
        result += check_diff(e, x, d, 2);
        
        d = 2*b*pow(e2,2)*pow(x,2) + e2 + y*e2*pow(x,2);
@@ -178,15 +178,15 @@ static unsigned exam_differentiation4(void)
        result += check_diff(e, x, d);
        
        d = 2*b*pow((2*x*y + a),2)*pow(e1,-2) + 4*b*y*e2/e1
-               - 2*b*e2*pow(2*x*y + a,2)*pow(e1,-2) + 2*pow(y,2)/e1
-               - y*pow(2*x*y + a,2)*pow(e1,-2);
+           - 2*b*e2*pow(2*x*y + a,2)*pow(e1,-2) + 2*pow(y,2)/e1
+           - y*pow(2*x*y + a,2)*pow(e1,-2);
        result += check_diff(e, x, d, 2);
        
        d = 2*b*e2*pow(x,2)/e1 + e2 + y*pow(x,2)/e1;
        result += check_diff(e, y, d);
        
        d = 2*b*pow(x,4)*pow(e1,-2) - 2*b*e2*pow(e1,-2)*pow(x,4)
-               + 2*pow(x,2)/e1 - y*pow(x,4)*pow(e1,-2);
+           + 2*pow(x,2)/e1 - y*pow(x,4)*pow(e1,-2);
        result += check_diff(e, y, d, 2);
 
        return result;
@@ -203,25 +203,11 @@ static unsigned exam_differentiation5(void)
        e1 = y*pow(x, 2) + a*x + b;
        e2 = x*pow(y, 2) + b*y + a;
        e = atan2(e1,e2);
-       /*
-       d = pow(y,2)*(-b-y*pow(x,2)-a*x)/(pow(b+y*pow(x,2)+a*x,2)+pow(x*pow(y,2)+b*y+a,2))
-               +(2*y*x+a)/((x*pow(y,2)+b*y+a)*(1+pow(b*y*pow(x,2)+a*x,2)/pow(x*pow(y,2)+b*y+a,2)));
-       */
-       /*
-       d = ((a+2*y*x)*pow(y*b+pow(y,2)*x+a,-1)-(a*x+b+y*pow(x,2))*
-                pow(y*b+pow(y,2)*x+a,-2)*pow(y,2))*
-               pow(1+pow(a*x+b+y*pow(x,2),2)*pow(y*b+pow(y,2)*x+a,-2),-1);
-       */
-       /*
-       d = pow(1+pow(a*x+b+y*pow(x,2),2)*pow(y*b+pow(y,2)*x+a,-2),-1)
-               *pow(y*b+pow(y,2)*x+a,-1)*(a+2*y*x)
-               +pow(y,2)*(-a*x-b-y*pow(x,2))*
-               pow(pow(y*b+pow(y,2)*x+a,2)+pow(a*x+b+y*pow(x,2),2),-1);
-       */
+       
        d = pow(y,2)*pow(pow(b+y*pow(x,2)+x*a,2)+pow(y*b+pow(y,2)*x+a,2),-1)*
-               (-b-y*pow(x,2)-x*a)+
-               pow(pow(b+y*pow(x,2)+x*a,2)+pow(y*b+pow(y,2)*x+a,2),-1)*
-               (y*b+pow(y,2)*x+a)*(2*y*x+a);
+           (-b-y*pow(x,2)-x*a)
+          +pow(pow(b+y*pow(x,2)+x*a,2)+pow(y*b+pow(y,2)*x+a,2),-1)*
+           (y*b+pow(y,2)*x+a)*(2*y*x+a);
        result += check_diff(e, x, d);
        
        return result;
@@ -241,7 +227,7 @@ static unsigned exam_differentiation6(void)
        
        if ((ed - d).compare(ex(0)) != 0) {
                clog << "derivative of " << e << " by " << x << " returned "
-                        << ed << " instead of " << d << ")" << endl;
+                    << ed << " instead of " << d << ")" << endl;
                return 1;
        }
        return 0;
@@ -254,18 +240,18 @@ static unsigned exam_differentiation7(void)
        ex P = x + pow(x,3);
        ex e = (P.diff(x) / P).diff(x, 2);
        ex d = 6/P - 18*x/pow(P,2) - 54*pow(x,3)/pow(P,2) + 2/pow(P,3)
-               +18*pow(x,2)/pow(P,3) + 54*pow(x,4)/pow(P,3) + 54*pow(x,6)/pow(P,3);
+           +18*pow(x,2)/pow(P,3) + 54*pow(x,4)/pow(P,3) + 54*pow(x,6)/pow(P,3);
        
        if (!(e-d).expand().is_zero()) {
                clog << "expanded second derivative of " << (P.diff(x) / P) << " by " << x
-                        << " returned " << e.expand() << " instead of " << d << endl;
+                    << " returned " << e.expand() << " instead of " << d << endl;
                return 1;
        }
        if (e.nops() > 3) {
                clog << "second derivative of " << (P.diff(x) / P) << " by " << x
-                        << " has " << e.nops() << " operands.  "
-                        << "The result is still correct but not optimal: 3 are enough!  "
-                        << "(Hint: maybe the product rule for objects of class mul should be more careful about assembling the result?)" << endl;
+                    << " has " << e.nops() << " operands.  "
+                    << "The result is still correct but not optimal: 3 are enough!  "
+                    << "(Hint: maybe the product rule for objects of class mul should be more careful about assembling the result?)" << endl;
                return 1;
        }
        return 0;
index baeacfd46e9d6d262fa7c20de1af7186b70f7c53..91307518eb3b9156b8c7d6648a60d8c1381bfb8c 100644 (file)
@@ -33,7 +33,7 @@ static unsigned inifcns_consist_trans(void)
        chk = asin(1)-acos(0);
        if (!chk.is_zero()) {
                clog << "asin(1)-acos(0) erroneously returned " << chk
-                        << " instead of 0" << endl;
+                    << " instead of 0" << endl;
                ++result;
        }
        
@@ -42,7 +42,7 @@ static unsigned inifcns_consist_trans(void)
                - (1+pow(x,2))*pow(sin(atan(x)),2);
        if (chk != 1-pow(x,2)) {
                clog << "sin(acos(x))^2 + sin(asin(x))^2 - (1+x^2)*sin(atan(x))^2 "
-                        << "erroneously returned " << chk << " instead of 1-x^2" << endl;
+                    << "erroneously returned " << chk << " instead of 1-x^2" << endl;
                ++result;
        }
        
@@ -51,7 +51,7 @@ static unsigned inifcns_consist_trans(void)
                - (1+pow(x,2))*pow(cos(atan(x)),2);
        if (!chk.is_zero()) {
                clog << "cos(acos(x))^2 + cos(asin(x))^2 - (1+x^2)*cos(atan(x))^2 "
-                        << "erroneously returned " << chk << " instead of 0" << endl;
+                    << "erroneously returned " << chk << " instead of 0" << endl;
                ++result;
        }
        
@@ -59,7 +59,7 @@ static unsigned inifcns_consist_trans(void)
        chk = tan(acos(x))*tan(asin(x)) - tan(atan(x));
        if (chk != 1-x) {
                clog << "tan(acos(x))*tan(asin(x)) - tan(atan(x)) "
-                        << "erroneously returned " << chk << " instead of -x+1" << endl;
+                    << "erroneously returned " << chk << " instead of -x+1" << endl;
                ++result;
        }
        
@@ -68,7 +68,7 @@ static unsigned inifcns_consist_trans(void)
                - pow(sinh(asinh(x)),2);
        if (!chk.is_zero()) {
                clog << "expand(-(sinh(acosh(x)))^2)*(sinh(atanh(x))^2) - sinh(asinh(x))^2 "
-                        << "erroneously returned " << chk << " instead of 0" << endl;
+                    << "erroneously returned " << chk << " instead of 0" << endl;
                ++result;
        }
        
@@ -77,7 +77,7 @@ static unsigned inifcns_consist_trans(void)
                * pow(cosh(atanh(x)),2);
        if (chk != 1) {
                clog << "(cosh(asinh(x))^2 - 2*cosh(acosh(x))^2) * cosh(atanh(x))^2 "
-                        << "erroneously returned " << chk << " instead of 1" << endl;
+                    << "erroneously returned " << chk << " instead of 1" << endl;
                ++result;
        }
        
@@ -86,7 +86,7 @@ static unsigned inifcns_consist_trans(void)
                * pow(tanh(atanh(x)),2);
        if (chk != 2) {
                clog << "expand(tanh(acosh(x))^2 - tanh(asinh(x))^(-2)) * tanh(atanh(x))^2 "
-                        << "erroneously returned " << chk << " instead of 2" << endl;
+                    << "erroneously returned " << chk << " instead of 2" << endl;
                ++result;
        }
        
@@ -105,7 +105,7 @@ static unsigned inifcns_consist_gamma(void)
                e += tgamma(ex(i));
        if (e != numeric(874)) {
                clog << "tgamma(1)+...+tgamma(7) erroneously returned "
-                        << e << " instead of 874" << endl;
+                    << e << " instead of 874" << endl;
                ++result;
        }
        
@@ -114,14 +114,14 @@ static unsigned inifcns_consist_gamma(void)
                e *= tgamma(ex(i));     
        if (e != numeric(24883200)) {
                clog << "tgamma(1)*...*tgamma(7) erroneously returned "
-                        << e << " instead of 24883200" << endl;
+                    << e << " instead of 24883200" << endl;
                ++result;
        }
        
        e = tgamma(ex(numeric(5, 2)))*tgamma(ex(numeric(9, 2)))*64;
        if (e != 315*Pi) {
                clog << "64*tgamma(5/2)*tgamma(9/2) erroneously returned "
-                        << e << " instead of 315*Pi" << endl;
+                    << e << " instead of 315*Pi" << endl;
                ++result;
        }
        
@@ -131,7 +131,7 @@ static unsigned inifcns_consist_gamma(void)
        e = (e*tgamma(ex(numeric(15, 2)))*numeric(512));
        if (e != numeric(633935)*Pi) {
                clog << "512*(tgamma(-13/2)+...+tgamma(5/2))*tgamma(15/2) erroneously returned "
-                        << e << " instead of 633935*Pi" << endl;
+                    << e << " instead of 633935*Pi" << endl;
                ++result;
        }
        
@@ -152,7 +152,7 @@ static unsigned inifcns_consist_psi(void)
        e -= (tgamma(x).diff(x)/tgamma(x)).subs(x==numeric(1,2));
        if (e!=2*log(2)) {
                clog << "tgamma(1)'/tgamma(1) - tgamma(1/2)'/tgamma(1/2) erroneously returned "
-                        << e << " instead of 2*log(2)" << endl;
+                    << e << " instead of 2*log(2)" << endl;
                ++result;
        }
        
@@ -171,7 +171,7 @@ static unsigned inifcns_consist_zeta(void)
                e += zeta(i)/pow(Pi,i);
        if (e!=numeric(-204992279,638512875)) {
                clog << "zeta(0) + zeta(2) + ... + zeta(12) erroneously returned "
-                        << e << " instead of -204992279/638512875" << endl;
+                    << e << " instead of -204992279/638512875" << endl;
                ++result;
        }
        
@@ -180,7 +180,7 @@ static unsigned inifcns_consist_zeta(void)
                e += zeta(i);
        if (e!=numeric(487871,1633632)) {
                clog << "zeta(-1) + zeta(-2) + ... + zeta(-15) erroneously returned "
-                        << e << " instead of 487871/1633632" << endl;
+                    << e << " instead of 487871/1633632" << endl;
                ++result;
        }
        
index cafda13a8ecec1f7bac8b9ddf17909a721b0c186..1a47865181df516bccab7a5286c84fc645d27769 100644 (file)
@@ -34,7 +34,7 @@ static unsigned exam_lsolve1(void)
        if (aux != 1) {
                ++result;
                clog << "solution of 3*x+5==8 erroneously returned "
-                        << aux << endl;
+                    << aux << endl;
        }
        
        return result;
@@ -62,7 +62,7 @@ static unsigned exam_lsolve2a(void)
                !normal(sol_y - (3-a*b)/(a+b)).is_zero()) {
                ++result;
                clog << "solution of the system " << eqns << " for " << vars
-                        << " erroneously returned " << sol << endl;
+                    << " erroneously returned " << sol << endl;
        }
        
        return result;
@@ -90,7 +90,7 @@ static unsigned exam_lsolve2b(void)
                (sol_y != numeric(-10,17))) {
                ++result;
                clog << "solution of the system " << eqns << " for " << vars
-                        << " erroneously returned " << sol << endl;
+                    << " erroneously returned " << sol << endl;
        }
        
        return result;
@@ -118,7 +118,7 @@ static unsigned exam_lsolve2c(void)
                (sol_y != numeric(-1,2))) {
                ++result;
                clog << "solution of the system " << eqns << " for " << vars
-                        << " erroneously returned " << sol << endl;
+                    << " erroneously returned " << sol << endl;
        }
        
        return result;
@@ -146,7 +146,7 @@ static unsigned exam_lsolve2S(void)
                (sol_y != t)) {
                ++result;
                clog << "solution of the system " << eqns << " for " << vars
-                        << " erroneously returned " << sol << endl;
+                    << " erroneously returned " << sol << endl;
        }
        
        return result;
@@ -177,7 +177,7 @@ static unsigned exam_lsolve3S(void)
                (sol_z != (b+c)/2)) {
                ++result;
                clog << "solution of the system " << eqns << " for " << vars
-                        << " erroneously returned " << sol << endl;
+                    << " erroneously returned " << sol << endl;
        }
        
        return result;
index a032bfe8bb891577d162e170a0006c5b868d497d..5c98b1dc07f33f71b0e1607f38db37ddadb261fd 100644 (file)
@@ -37,7 +37,7 @@ static unsigned matrix_determinants(void)
        det = m1.determinant();
        if (det != a) {
                clog << "determinant of 1x1 matrix " << m1
-                        << " erroneously returned " << det << endl;
+                    << " erroneously returned " << det << endl;
                ++result;
        }
        
@@ -47,7 +47,7 @@ static unsigned matrix_determinants(void)
        det = m2.determinant();
        if (det != (a*d-b*c)) {
                clog << "determinant of 2x2 matrix " << m2
-                        << " erroneously returned " << det << endl;
+                    << " erroneously returned " << det << endl;
                ++result;
        }
        
@@ -58,7 +58,7 @@ static unsigned matrix_determinants(void)
        det = m3.determinant();
        if (det != (a*e*i - a*f*h - d*b*i + d*c*h + g*b*f - g*c*e)) {
                clog << "determinant of 3x3 matrix " << m3
-                        << " erroneously returned " << det << endl;
+                    << " erroneously returned " << det << endl;
                ++result;
        }
        
@@ -69,7 +69,7 @@ static unsigned matrix_determinants(void)
        det = m3.determinant();
        if (det != 42) {
                clog << "determinant of 3x3 matrix " << m3
-                        << " erroneously returned " << det << endl;
+                    << " erroneously returned " << det << endl;
                ++result;
        }
        
@@ -80,10 +80,10 @@ static unsigned matrix_determinants(void)
        if (det != 1) {
                if (det.normal() == 1)  // only half wrong
                        clog << "determinant of 2x2 matrix " << m2
-                                << " was returned unnormalized as " << det << endl;
+                            << " was returned unnormalized as " << det << endl;
                else  // totally wrong
                        clog << "determinant of 2x2 matrix " << m2
-                                << " erroneously returned " << det << endl;
+                            << " erroneously returned " << det << endl;
                ++result;
        }
        
@@ -92,7 +92,7 @@ static unsigned matrix_determinants(void)
        det = m4.determinant();
        if (det != a*b*c*d) {
                clog << "determinant of 4x4 matrix " << m4
-                        << " erroneously returned " << det << endl;
+                    << " erroneously returned " << det << endl;
                ++result;
        }
        
@@ -103,7 +103,7 @@ static unsigned matrix_determinants(void)
        ex p = m3.charpoly(a);
        if (p != 0) {
                clog << "charpoly of 3x3 matrix " << m3
-                        << " erroneously returned " << p << endl;
+                    << " erroneously returned " << p << endl;
                ++result;
        }
        
@@ -121,7 +121,7 @@ static unsigned matrix_invert1(void)
        
        if (m_i(0,0) != pow(a,-1)) {
                clog << "inversion of 1x1 matrix " << m
-                        << " erroneously returned " << m_i << endl;
+                    << " erroneously returned " << m_i << endl;
                ++result;
        }
        
@@ -143,7 +143,7 @@ static unsigned matrix_invert2(void)
                (normal(m_i(1,0)*det) != -c) ||
                (normal(m_i(1,1)*det) != a)) {
                clog << "inversion of 2x2 matrix " << m
-                        << " erroneously returned " << m_i << endl;
+                    << " erroneously returned " << m_i << endl;
                ++result;
        }
        
@@ -164,16 +164,16 @@ static unsigned matrix_invert3(void)
        ex det = m.determinant();
        
        if ((normal(m_i(0,0)*det) != (e*i-f*h)) ||
-               (normal(m_i(0,1)*det) != (c*h-b*i)) ||
-               (normal(m_i(0,2)*det) != (b*f-c*e)) ||
-               (normal(m_i(1,0)*det) != (f*g-d*i)) ||
-               (normal(m_i(1,1)*det) != (a*i-c*g)) ||
-               (normal(m_i(1,2)*det) != (c*d-a*f)) ||
-               (normal(m_i(2,0)*det) != (d*h-e*g)) ||
-               (normal(m_i(2,1)*det) != (b*g-a*h)) ||
-               (normal(m_i(2,2)*det) != (a*e-b*d))) {
+           (normal(m_i(0,1)*det) != (c*h-b*i)) ||
+           (normal(m_i(0,2)*det) != (b*f-c*e)) ||
+           (normal(m_i(1,0)*det) != (f*g-d*i)) ||
+           (normal(m_i(1,1)*det) != (a*i-c*g)) ||
+           (normal(m_i(1,2)*det) != (c*d-a*f)) ||
+           (normal(m_i(2,0)*det) != (d*h-e*g)) ||
+           (normal(m_i(2,1)*det) != (b*g-a*h)) ||
+           (normal(m_i(2,2)*det) != (a*e-b*d))) {
                clog << "inversion of 3x3 matrix " << m
-                        << " erroneously returned " << m_i << endl;
+                    << " erroneously returned " << m_i << endl;
                ++result;
        }
        
@@ -210,7 +210,7 @@ static unsigned matrix_solve2(void)
                                result = 1;
        if (result) {
                clog << "Solving " << A << " * " << X << " == " << B << endl
-                        << "erroneously returned " << sol << endl;
+                    << "erroneously returned " << sol << endl;
        }
        
        return result;
@@ -228,7 +228,7 @@ static unsigned matrix_misc(void)
        // check a simple trace
        if (tr.compare(a+d)) {
                clog << "trace of 2x2 matrix " << m1
-                        << " erroneously returned " << tr << endl;
+                    << " erroneously returned " << tr << endl;
                ++result;
        }
        
@@ -245,7 +245,7 @@ static unsigned matrix_misc(void)
        m3.set(2,0,e).set(2,1,f);
        if (transpose(transpose(m3)) != m3) {
                clog << "transposing 3x2 matrix " << m3 << " twice"
-                        << " erroneously returned " << transpose(transpose(m3)) << endl;
+                    << " erroneously returned " << transpose(transpose(m3)) << endl;
                ++result;
        }
        
@@ -260,7 +260,7 @@ static unsigned matrix_misc(void)
        }
        if (!caught) {
                cerr << "singular 2x2 matrix " << m4
-                        << " erroneously inverted to " << m5 << endl;
+                    << " erroneously inverted to " << m5 << endl;
                ++result;
        }
        
index 8052bda95804a4948fa8ccba6a2672fe33037050..6e047a50c3db2a18fe5665c5d7b820abce4a71c9 100644 (file)
@@ -42,7 +42,7 @@ static unsigned exam_expand_subs(void)
        
        if (e != pow(a1,2)) {
                clog << "Denny Fliegner's quick consistency check erroneously returned "
-                        << e << "." << endl;
+                    << e << "." << endl;
                ++result;
        }
        
@@ -65,7 +65,7 @@ static unsigned exam_expand_subs2(void)
        
        if (f != 0) {
                clog << "e = pow(a+b,200).expand(); f = e.subs(a == -b); erroneously returned "
-                        << f << " instead of simplifying to 0." << endl;
+                    << f << " instead of simplifying to 0." << endl;
                ++result;
        }
        
index 3cf251b85b4a0bdf977dd6837eacfdbf2fc57895..6f39422eb1ed0462e939d44c16a76dec26a152be 100644 (file)
@@ -37,12 +37,12 @@ static unsigned lortensor_check1(void)
        e6 = e4 - e5; // g(~mu,_mu) - g(_mu,~mu) = 0!
        if (!e3.is_zero()) {
                clog << e1 << "-" << e2 << " erroneously returned "
-                        << e3 << " instead of 0" << endl;
+                    << e3 << " instead of 0" << endl;
                ++result;
        }
        if (!e6.is_zero()) {
                clog << e4 << "-" << e5 << " erroneously returned "
-                        << e6 << " instead of 0" << endl;
+                    << e6 << " instead of 0" << endl;
                ++result;
        }
 
@@ -68,17 +68,17 @@ static unsigned lortensor_check2(void)
        e10 = simplify_lortensor(e8 * e7) - e9; // F(_mu,_nu) g(~nu,~rho) - F(_mu,~rho) = 0!
        if (!e5.is_zero()) {
                clog << e3 << "*" << e1 << "-" << e3 << "*" << e2 << " erroneously returned "
-                        << e5 << " instead of 0" << endl;
+                    << e5 << " instead of 0" << endl;
                ++result;
        }
        if (!e6.is_zero()) {    
                clog << " simplify_lortensor(e3 * e1)" << "-" << e4 << " erroneously returned"
-                        << e6 << " instead of 0" << endl;
+                    << e6 << " instead of 0" << endl;
                ++result;
        }
        if (!e10.is_zero()) {           
                clog << " simplify_lortensor(e8 * e7)" << "-" << e9 << " erroneously returned"
-                        << e10 << " instead of 0" << endl;
+                    << e10 << " instead of 0" << endl;
                ++result;
        }
 
index 50d717dabc3e767b9c0fbde27889cc81214f37a7..6ce7a70fb3893ba9e49ecccf0fe9ec37d5ddfa7f 100644 (file)
@@ -29,7 +29,7 @@ static unsigned check_normal(const ex &e, const ex &d)
        ex en = e.normal();
        if (en.compare(d) != 0) {
                clog << "normal form of " << e << " erroneously returned "
-                        << en << " (should be " << d << ")" << endl;
+                    << en << " (should be " << d << ")" << endl;
                return 1;
        }
        return 0;
index 04cf3547626d502b5b02958b5722ffb4cb129220..aa7bb2d79070ae7e87676630eddec90bc9bd67df 100644 (file)
@@ -38,18 +38,18 @@ static unsigned exam_numeric1(void)
        
        if (!test_int1.is_integer()) {
                clog << test_int1
-                        << " erroneously not recognized as integer" << endl;
+                    << " erroneously not recognized as integer" << endl;
                ++result;
        }
        if (!test_int1.is_rational()) {
                clog << test_int1
-                        << " erroneously not recognized as rational" << endl;
+                    << " erroneously not recognized as rational" << endl;
                ++result;
        }
        
        if (!test_rat1.is_rational()) {
                clog << test_rat1
-                        << " erroneously not recognized as rational" << endl;
+                    << " erroneously not recognized as rational" << endl;
                ++result;
        }
        if (test_rat1.is_integer()) {
@@ -60,28 +60,28 @@ static unsigned exam_numeric1(void)
        
        if (!test_crat.is_crational()) {
                clog << test_crat
-                        << " erroneously not recognized as complex rational" << endl;
+                    << " erroneously not recognized as complex rational" << endl;
                ++result;
        }
        
        int i = numeric(1984).to_int();
        if (i-1984) {
                clog << "conversion of " << i
-                        << " from numeric to int failed" << endl;
+                    << " from numeric to int failed" << endl;
                ++result;
        }
        
        e1 = test_int1;
        if (!e1.info(info_flags::posint)) {
                clog << "expression " << e1
-                        << " erroneously not recognized as positive integer" << endl;
+                    << " erroneously not recognized as positive integer" << endl;
                ++result;
        }
        
        e2 = test_int1 + a;
        if (ex_to_numeric(e2).is_integer()) {
                clog << "expression " << e2
-                        << " erroneously recognized as integer" << endl;
+                    << " erroneously recognized as integer" << endl;
                ++result;
        }
        
@@ -90,7 +90,7 @@ static unsigned exam_numeric1(void)
        test_rat1 += test_rat1;
        if (!test_rat1.is_integer()) {
                clog << "3/2 + 3/2 erroneously not integer 3 but instead "
-                        << test_rat1 << endl;
+                    << test_rat1 << endl;
                ++result;
        }
        test_rat1 = numeric(3)/numeric(2);
@@ -98,7 +98,7 @@ static unsigned exam_numeric1(void)
        test_rat2 -= test_rat1;  // 1
        if (!test_rat2.is_integer()) {
                clog << "5/2 - 3/2 erroneously not integer 1 but instead "
-                        << test_rat2 << endl;
+                    << test_rat2 << endl;
                ++result;
        }
        
@@ -162,7 +162,7 @@ static unsigned exam_numeric3(void)
        a = 23; b = 4; calc_rem = irem(a, b);
        if (calc_rem != 3) {
                clog << "irem(" << a << "," << b << ") erroneously returned "
-                        << calc_rem << endl;
+                    << calc_rem << endl;
                ++result;
        }
        a = 23; b = -4; calc_rem = irem(a, b);
@@ -174,38 +174,38 @@ static unsigned exam_numeric3(void)
        a = -23; b = 4; calc_rem = irem(a, b);
        if (calc_rem != -3) {
                clog << "irem(" << a << "," << b << ") erroneously returned "
-                        << calc_rem << endl;
+                    << calc_rem << endl;
                ++result;
        }
        a = -23; b = -4; calc_rem = irem(a, b);
        if (calc_rem != -3) {
                clog << "irem(" << a << "," << b << ") erroneously returned "
-                        << calc_rem << endl;
+                    << calc_rem << endl;
                ++result;
        }
        // and now the overloaded irem(a,b,q):
        a = 23; b = 4; calc_rem = irem(a, b, calc_quo);
        if (calc_rem != 3 || calc_quo != 5) {
                clog << "irem(" << a << "," << b << ",q) erroneously returned "
-                        << calc_rem << " with q=" << calc_quo << endl;
+                    << calc_rem << " with q=" << calc_quo << endl;
                ++result;
        }
        a = 23; b = -4; calc_rem = irem(a, b, calc_quo);
        if (calc_rem != 3 || calc_quo != -5) {
                clog << "irem(" << a << "," << b << ",q) erroneously returned "
-                        << calc_rem << " with q=" << calc_quo << endl;
+                    << calc_rem << " with q=" << calc_quo << endl;
                ++result;
        }
        a = -23; b = 4; calc_rem = irem(a, b, calc_quo);
        if (calc_rem != -3 || calc_quo != -5) {
                clog << "irem(" << a << "," << b << ",q) erroneously returned "
-                        << calc_rem << " with q=" << calc_quo << endl;
+                    << calc_rem << " with q=" << calc_quo << endl;
                ++result;
        }
        a = -23; b = -4; calc_rem = irem(a, b, calc_quo);
        if (calc_rem != -3 || calc_quo != 5) {
                clog << "irem(" << a << "," << b << ",q) erroneously returned "
-                        << calc_rem << " with q=" << calc_quo << endl;
+                    << calc_rem << " with q=" << calc_quo << endl;
                ++result;
        }
        // check if iquo(a, b) and iquo(a, b, r) really behave like Maple's 
@@ -215,50 +215,50 @@ static unsigned exam_numeric3(void)
        a = 23; b = 4; calc_quo = iquo(a, b);
        if (calc_quo != 5) {
                clog << "iquo(" << a << "," << b << ") erroneously returned "
-                        << calc_quo << endl;
+                    << calc_quo << endl;
                ++result;
        }
        a = 23; b = -4; calc_quo = iquo(a, b);
        if (calc_quo != -5) {
                clog << "iquo(" << a << "," << b << ") erroneously returned "
-                        << calc_quo << endl;
+                    << calc_quo << endl;
                ++result;
        }
        a = -23; b = 4; calc_quo = iquo(a, b);
        if (calc_quo != -5) {
                clog << "iquo(" << a << "," << b << ") erroneously returned "
-                        << calc_quo << endl;
+                    << calc_quo << endl;
                ++result;
        }
        a = -23; b = -4; calc_quo = iquo(a, b);
        if (calc_quo != 5) {
                clog << "iquo(" << a << "," << b << ") erroneously returned "
-                        << calc_quo << endl;
+                    << calc_quo << endl;
                ++result;
        }
        // and now the overloaded iquo(a,b,r):
        a = 23; b = 4; calc_quo = iquo(a, b, calc_rem);
        if (calc_quo != 5 || calc_rem != 3) {
                clog << "iquo(" << a << "," << b << ",r) erroneously returned "
-                        << calc_quo << " with r=" << calc_rem << endl;
+                    << calc_quo << " with r=" << calc_rem << endl;
                ++result;
        }
        a = 23; b = -4; calc_quo = iquo(a, b, calc_rem);
        if (calc_quo != -5 || calc_rem != 3) {
                clog << "iquo(" << a << "," << b << ",r) erroneously returned "
-                        << calc_quo << " with r=" << calc_rem << endl;
+                    << calc_quo << " with r=" << calc_rem << endl;
                ++result;
        }
        a = -23; b = 4; calc_quo = iquo(a, b, calc_rem);
        if (calc_quo != -5 || calc_rem != -3) {
                clog << "iquo(" << a << "," << b << ",r) erroneously returned "
-                        << calc_quo << " with r=" << calc_rem << endl;
+                    << calc_quo << " with r=" << calc_rem << endl;
                ++result;
        }
        a = -23; b = -4; calc_quo = iquo(a, b, calc_rem);
        if (calc_quo != 5 || calc_rem != -3) {
                clog << "iquo(" << a << "," << b << ",r) erroneously returned "
-                        << calc_quo << " with r=" << calc_rem << endl;
+                    << calc_quo << " with r=" << calc_rem << endl;
                ++result;
        }
        
@@ -274,11 +274,9 @@ static unsigned exam_numeric4(void)
        
        // square roots of squares of integers:
        passed = true;
-       for (int i=0; i<42; ++i) {
-               if (!sqrt(numeric(i*i)).is_integer()) {
+       for (int i=0; i<42; ++i)
+               if (!sqrt(numeric(i*i)).is_integer())
                        passed = false;
-               }
-       }
        if (!passed) {
                clog << "One or more square roots of squares of integers did not return exact integers" << endl;
                ++result;
@@ -286,13 +284,10 @@ static unsigned exam_numeric4(void)
        
        // square roots of squares of rationals:
        passed = true;
-       for (int num=0; num<41; ++num) {
-               for (int den=1; den<42; ++den) {
-                       if (!sqrt(numeric(num*num)/numeric(den*den)).is_rational()) {
+       for (int num=0; num<41; ++num)
+               for (int den=1; den<42; ++den)
+                       if (!sqrt(numeric(num*num)/numeric(den*den)).is_rational())
                                passed = false;
-                       }
-               }
-       }
        if (!passed) {
                clog << "One or more square roots of squares of rationals did not return exact integers" << endl;
                ++result;
@@ -313,7 +308,7 @@ static unsigned exam_numeric5(void)
        ex e2 = expand(e1 - 10 + 5*pow(3,numeric(3,5)));
        if (!e2.is_zero()) {
                clog << "expand((1+3^(1/5)-3^(2/5))^3-10+5*3^(3/5)) returned "
-                        << e2 << " instead of 0." << endl;
+                    << e2 << " instead of 0." << endl;
                ++result;
        }
        
index c4383c7cf6191aeef4a3c2b470a99733952ec6e5..94bfbacb1e0579c57aac07a8e02f782f3afd0f07 100644 (file)
@@ -41,7 +41,7 @@ static unsigned exam_paranoia1(void)
        // In the first one expand did not do any job at all:
        if (!g.expand().is_equal(x)) {
                clog << "e = x*y*z; f = y*z; expand(e/f) erroneously returned "
-                        << g.expand() << endl;
+                    << g.expand() << endl;
                ++result;
        }
 
@@ -49,7 +49,7 @@ static unsigned exam_paranoia1(void)
        e = pow(x + 1, -1);
        if (!e.expand().is_equal(e)) {
                clog << "expand(pow(x + 1, -1)) erroneously returned "
-                        << e.expand() << endl;
+                    << e.expand() << endl;
                ++result;
        }
 
@@ -72,20 +72,20 @@ static unsigned exam_paranoia2(void)
        // After .expand(), g should be zero:
        if (!g.expand().is_zero()) {
                clog << "e = (x + z*x); f = e*y; expand(f - e*y) erroneously returned "
-                        << g.expand() << endl;
+                    << g.expand() << endl;
                ++result;
        }
        // After .eval(), g should be zero:
        if (!g.eval().is_zero()) {
                clog << "e = (x + z*x); f = e*y; eval(f - e*y) erroneously returned "
-                        << g.eval() << endl;
+                    << g.eval() << endl;
                ++result;
        }
        // This actually worked already back in April 1999.
        // But we are *very* paranoic!
        if (!g.expand().eval().is_zero()) {
                clog << "e = (x + z*x); f = e*y; eval(expand(f - e*y)) erroneously returned "
-                        << g.expand().eval() << endl;
+                    << g.expand().eval() << endl;
                ++result;
        }
 
@@ -106,17 +106,17 @@ static unsigned exam_paranoia3(void)
 
        if (!f.is_equal(y)) {
                clog << "e = x*y - y; f = e.subs(x == 2) erroneously returned "
-                        << f << endl;
+                    << f << endl;
                ++result;
        }
        if (!f.eval().is_equal(y)) {
                clog << "e = x*y - y; eval(e.subs(x == 2)) erroneously returned "
-                        << f.eval() << endl;
+                    << f.eval() << endl;
                ++result;
        }
        if (!f.expand().is_equal(y)) {
                clog << "e = x*y - y; expand(e.subs(x == 2)) erroneously returned "
-                        << f.expand() << endl;
+                    << f.expand() << endl;
                ++result;
        }
 
@@ -136,12 +136,12 @@ static unsigned exam_paranoia4(void)
 
        if (!g.is_zero()) {
                clog << "e = pow(x,2) + x + 1; f = pow(x,2) + x + 1; g = e-f; g erroneously returned "
-                        << g << endl;
+                    << g << endl;
                ++result;
        }
        if (!g.is_zero()) {
                clog << "e = pow(x,2) + x + 1; f = pow(x,2) + x + 1; g = e-f; g.eval() erroneously returned "
-                        << g.eval() << endl;
+                    << g.eval() << endl;
                ++result;
        }
 
@@ -160,7 +160,7 @@ static unsigned exam_paranoia5(void)
 
        if (!(e-f).expand().is_zero()) {
                clog << "e = pow(x*y+1,2); f = pow(x,2)*pow(y,2) + 2*x*y + 1; (e-f).expand() erroneously returned "
-                        << (e-f).expand() << endl;
+                    << (e-f).expand() << endl;
                ++result;
        }
 
@@ -196,8 +196,8 @@ static unsigned exam_paranoia7(void)
 
        if (f.nops() > 3) {
                clog << "e=y+y*x+2; f=expand(pow(e,2)-(e*y*(x+1))) has "
-                        << f.nops() << " arguments instead of 3 ( f=="
-                        << f << " )" << endl;
+                    << f.nops() << " arguments instead of 3 ( f=="
+                    << f << " )" << endl;
                ++result;
        }
        return result;
@@ -306,7 +306,7 @@ static unsigned exam_paranoia12(void)
        
        if (!(f - d).expand().is_zero()) {
                clog << "normal(" << e << ") returns " << f
-                        << " instead of " << d << endl;
+                    << " instead of " << d << endl;
                ++result;
        }
        return result;
@@ -326,7 +326,7 @@ static unsigned exam_paranoia13(void)
                ex f = e.normal();      
                if (!(f - d).expand().is_zero()) {
                        clog << "normal(" << e << ") returns " << f
-                                << " instead of " << d << endl;
+                            << " instead of " << d << endl;
                        ++result;
                }
        } catch (const exception &err) {
index 5680bec0307ea12e6da16414e6b4e29a3251967d..54142b80f8a05cada210189004be0199617705d0 100644 (file)
@@ -236,7 +236,7 @@ unsigned exam_polygcd(void)
        result += poly_gcd1();  cout << '.' << flush;
        result += poly_gcd2();  cout << '.' << flush;
        result += poly_gcd3();  cout << '.' << flush;
-       result += poly_gcd3p();  cout << '.' << flush; // takes extremely long (PRS "worst" case)
+       result += poly_gcd3p();  cout << '.' << flush; // PRS "worst" case
        result += poly_gcd4();  cout << '.' << flush;
        result += poly_gcd5();  cout << '.' << flush;
        result += poly_gcd5p();  cout << '.' << flush;
index f685ffb12e26f1782999322eb9073fa2e5ed8048..8513caebfdb68976eb3b068c7dfe99d6c9f4a36b 100644 (file)
@@ -31,67 +31,67 @@ static unsigned exam_powerlaws1(void)
        symbol a("a");
        symbol b("b");
        
-       ex e1=power(power(x,a),b);
+       ex e1 = power(power(x,a), b);
        if (!(is_ex_exactly_of_type(e1,power) &&
-                 is_ex_exactly_of_type(e1.op(0),power) &&
-                 is_ex_exactly_of_type(e1.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e1.op(0).op(1),symbol) &&
-                 is_ex_exactly_of_type(e1.op(1),symbol) &&
-                 e1.is_equal(power(power(x,a),b)) )) {
+             is_ex_exactly_of_type(e1.op(0),power) &&
+             is_ex_exactly_of_type(e1.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e1.op(0).op(1),symbol) &&
+             is_ex_exactly_of_type(e1.op(1),symbol) &&
+             e1.is_equal(power(power(x,a),b)) )) {
                clog << "(x^a)^b, x,a,b symbolic wrong" << endl;
                clog << "returned: " << e1 << endl;
                return 1;
        }
        
-       ex e2=e1.subs(a==1);
+       ex e2 = e1.subs(a==1);
        if (!(is_ex_exactly_of_type(e2,power) &&
-                 is_ex_exactly_of_type(e2.op(0),symbol) &&
-                 is_ex_exactly_of_type(e2.op(1),symbol) &&
-                 e2.is_equal(power(x,b)) )) {
+             is_ex_exactly_of_type(e2.op(0),symbol) &&
+             is_ex_exactly_of_type(e2.op(1),symbol) &&
+             e2.is_equal(power(x,b)) )) {
                clog << "(x^a)^b, x,b symbolic, a==1 wrong" << endl;
                clog << "returned: " << e2 << endl;
                return 1;
        }
        
-       ex e3=e1.subs(a==-1);
+       ex e3 = e1.subs(a==-1);
        if (!(is_ex_exactly_of_type(e3,power) &&
-                 is_ex_exactly_of_type(e3.op(0),power) &&
-                 is_ex_exactly_of_type(e3.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e3.op(0).op(1),numeric) &&
-                 is_ex_exactly_of_type(e3.op(1),symbol) &&
-                 e3.is_equal(power(power(x,-1),b)) )) {
+             is_ex_exactly_of_type(e3.op(0),power) &&
+             is_ex_exactly_of_type(e3.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e3.op(0).op(1),numeric) &&
+             is_ex_exactly_of_type(e3.op(1),symbol) &&
+             e3.is_equal(power(power(x,-1),b)) )) {
                clog << "(x^a)^b, x,b symbolic, a==-1 wrong" << endl;
                clog << "returned: " << e3 << endl;
                return 1;
        }
        
-       ex e4=e1.subs(lst(a==-1,b==2.5));
+       ex e4 = e1.subs(lst(a==-1, b==2.5));
        if (!(is_ex_exactly_of_type(e4,power) &&
-                 is_ex_exactly_of_type(e4.op(0),power) &&
-                 is_ex_exactly_of_type(e4.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e4.op(0).op(1),numeric) &&
-                 is_ex_exactly_of_type(e4.op(1),numeric) &&
-                 e4.is_equal(power(power(x,-1),2.5)) )) {
+             is_ex_exactly_of_type(e4.op(0),power) &&
+             is_ex_exactly_of_type(e4.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e4.op(0).op(1),numeric) &&
+             is_ex_exactly_of_type(e4.op(1),numeric) &&
+             e4.is_equal(power(power(x,-1),2.5)) )) {
                clog << "(x^a)^b, x symbolic, a==-1, b==2.5 wrong" << endl;
                clog << "returned: " << e4 << endl;
                return 1;
        }
        
-       ex e5=e1.subs(lst(a==-0.9,b==2.5));
+       ex e5 = e1.subs(lst(a==-0.9, b==2.5));
        if (!(is_ex_exactly_of_type(e5,power) &&
-                 is_ex_exactly_of_type(e5.op(0),symbol) &&
-                 is_ex_exactly_of_type(e5.op(1),numeric) &&
-                 e5.is_equal(power(x,numeric(-0.9)*numeric(2.5))) )) {
+             is_ex_exactly_of_type(e5.op(0),symbol) &&
+             is_ex_exactly_of_type(e5.op(1),numeric) &&
+             e5.is_equal(power(x,numeric(-0.9)*numeric(2.5))) )) {
                clog << "(x^a)^b, x symbolic, a==-0.9, b==2.5 wrong" << endl;
                clog << "returned: " << e5 << endl;
                return 1;
        }
        
-       ex e6=e1.subs(lst(a==numeric(3)+numeric(5.3)*I,b==-5));
+       ex e6 = e1.subs(lst(a==numeric(3)+numeric(5.3)*I, b==-5));
        if (!(is_ex_exactly_of_type(e6,power) &&
-                 is_ex_exactly_of_type(e6.op(0),symbol) &&
-                 is_ex_exactly_of_type(e6.op(1),numeric) &&
-                 e6.is_equal(power(x,numeric(-15)+numeric(5.3)*numeric(-5)*I)) )) {
+             is_ex_exactly_of_type(e6.op(0),symbol) &&
+             is_ex_exactly_of_type(e6.op(1),numeric) &&
+             e6.is_equal(power(x,numeric(-15)+numeric(5.3)*numeric(-5)*I)) )) {
                clog << "(x^a)^b, x symbolic, a==3+5.3*I, b==-5 wrong" << endl;
                clog << "returned: " << e6 << endl;
                return 1;
@@ -108,88 +108,88 @@ static unsigned exam_powerlaws2(void)
        symbol a("a");
        symbol b("b");
        
-       ex e1=power(a*x,b);
+       ex e1 = power(a*x,b);
        if (!(is_ex_exactly_of_type(e1,power) &&
-                 is_ex_exactly_of_type(e1.op(0),mul) &&
-                 (e1.op(0).nops()==2) &&
-                 is_ex_exactly_of_type(e1.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e1.op(0).op(1),symbol) &&
-                 is_ex_exactly_of_type(e1.op(1),symbol) &&
-                 e1.is_equal(power(a*x,b)) )) {
+             is_ex_exactly_of_type(e1.op(0),mul) &&
+             (e1.op(0).nops()==2) &&
+             is_ex_exactly_of_type(e1.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e1.op(0).op(1),symbol) &&
+             is_ex_exactly_of_type(e1.op(1),symbol) &&
+             e1.is_equal(power(a*x,b)) )) {
                clog << "(a*x)^b, x,a,b symbolic wrong" << endl;
                clog << "returned: " << e1 << endl;
                return 1;
        }
        
-       ex e2=e1.subs(a==3);
+       ex e2 = e1.subs(a==3);
        if (!(is_ex_exactly_of_type(e2,power) &&
-                 is_ex_exactly_of_type(e2.op(0),mul) &&
-                 (e2.op(0).nops()==2) &&
-                 is_ex_exactly_of_type(e2.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e2.op(0).op(1),numeric) &&
-                 is_ex_exactly_of_type(e2.op(1),symbol) &&
-                 e2.is_equal(power(3*x,b)) )) {
+             is_ex_exactly_of_type(e2.op(0),mul) &&
+             (e2.op(0).nops()==2) &&
+             is_ex_exactly_of_type(e2.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e2.op(0).op(1),numeric) &&
+             is_ex_exactly_of_type(e2.op(1),symbol) &&
+             e2.is_equal(power(3*x,b)) )) {
                clog << "(a*x)^b, x,b symbolic, a==3 wrong" << endl;
                clog << "returned: " << e2 << endl;
                return 1;
        }
        
-       ex e3=e1.subs(b==-3);
+       ex e3 = e1.subs(b==-3);
        if (!(is_ex_exactly_of_type(e3,mul) &&
-                 (e3.nops()==2) &&
-                 is_ex_exactly_of_type(e3.op(0),power) &&
-                 is_ex_exactly_of_type(e3.op(1),power) &&
-                 e3.is_equal(power(a,-3)*power(x,-3)) )) {
+             (e3.nops()==2) &&
+             is_ex_exactly_of_type(e3.op(0),power) &&
+             is_ex_exactly_of_type(e3.op(1),power) &&
+             e3.is_equal(power(a,-3)*power(x,-3)) )) {
                clog << "(a*x)^b, x,a symbolic, b==-3 wrong" << endl;
                clog << "returned: " << e3 << endl;
                return 1;
        }
        
-       ex e4=e1.subs(b==4.5);
+       ex e4 = e1.subs(b==4.5);
        if (!(is_ex_exactly_of_type(e4,power) &&
-                 is_ex_exactly_of_type(e4.op(0),mul) &&
-                 (e4.op(0).nops()==2) &&
-                 is_ex_exactly_of_type(e4.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e4.op(0).op(1),symbol) &&
-                 is_ex_exactly_of_type(e4.op(1),numeric) &&
-                 e4.is_equal(power(a*x,4.5)) )) {
+             is_ex_exactly_of_type(e4.op(0),mul) &&
+             (e4.op(0).nops()==2) &&
+             is_ex_exactly_of_type(e4.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e4.op(0).op(1),symbol) &&
+             is_ex_exactly_of_type(e4.op(1),numeric) &&
+             e4.is_equal(power(a*x,4.5)) )) {
                clog << "(a*x)^b, x,a symbolic, b==4.5 wrong" << endl;
                clog << "returned: " << e4 << endl;
                return 1;
        }
        
-       ex e5=e1.subs(lst(a==3.2,b==3+numeric(5)*I));
+       ex e5 = e1.subs(lst(a==3.2, b==3+numeric(5)*I));
        if (!(is_ex_exactly_of_type(e5,mul) &&
-                 (e5.nops()==2) &&
-                 is_ex_exactly_of_type(e5.op(0),power) &&
-                 is_ex_exactly_of_type(e5.op(1),numeric) &&
-                 e5.is_equal(power(x,3+numeric(5)*I)*
+             (e5.nops()==2) &&
+             is_ex_exactly_of_type(e5.op(0),power) &&
+             is_ex_exactly_of_type(e5.op(1),numeric) &&
+             e5.is_equal(power(x,3+numeric(5)*I)*
                                          power(numeric(3.2),3+numeric(5)*I)) )) {
                clog << "(a*x)^b, x symbolic, a==3.2, b==3+5*I wrong" << endl;
                clog << "returned: " << e5 << endl;
                return 1;
        }
        
-       ex e6=e1.subs(lst(a==-3.2,b==3+numeric(5)*I));
+       ex e6 = e1.subs(lst(a==-3.2, b==3+numeric(5)*I));
        if (!(is_ex_exactly_of_type(e6,mul) &&
-                 (e6.nops()==2) &&
-                 is_ex_exactly_of_type(e6.op(0),power) &&
-                 is_ex_exactly_of_type(e6.op(1),numeric) &&
-                 e6.is_equal(power(-x,3+numeric(5)*I)*
+             (e6.nops()==2) &&
+             is_ex_exactly_of_type(e6.op(0),power) &&
+             is_ex_exactly_of_type(e6.op(1),numeric) &&
+             e6.is_equal(power(-x,3+numeric(5)*I)*
                                          power(numeric(3.2),3+numeric(5)*I)) )) {
                clog << "(a*x)^b, x symbolic, a==-3.2, b==3+5*I wrong" << endl;
                clog << "returned: " << e6 << endl;
                return 1;
        }
        
-       ex e7=e1.subs(lst(a==3+numeric(5)*I,b==3.2));
+       ex e7 = e1.subs(lst(a==3+numeric(5)*I, b==3.2));
        if (!(is_ex_exactly_of_type(e7,power) &&
-                 is_ex_exactly_of_type(e7.op(0),mul) &&
-                 (e7.op(0).nops()==2) &&
-                 is_ex_exactly_of_type(e7.op(0).op(0),symbol) &&
-                 is_ex_exactly_of_type(e7.op(0).op(1),numeric) &&
-                 is_ex_exactly_of_type(e7.op(1),numeric) &&
-                 e7.is_equal(power((3+numeric(5)*I)*x,3.2)) )) {
+             is_ex_exactly_of_type(e7.op(0),mul) &&
+             (e7.op(0).nops()==2) &&
+             is_ex_exactly_of_type(e7.op(0).op(0),symbol) &&
+             is_ex_exactly_of_type(e7.op(0).op(1),numeric) &&
+             is_ex_exactly_of_type(e7.op(1),numeric) &&
+             e7.is_equal(power((3+numeric(5)*I)*x,3.2)) )) {
                clog << "(a*x)^b, x symbolic, a==3+5*I, b==3.2 wrong" << endl;
                clog << "returned: " << e7 << endl;
                return 1;
@@ -216,8 +216,8 @@ static unsigned exam_powerlaws3(void)
        
        ex e3 = power(numeric(5),numeric(1,2));
        if (!(is_ex_exactly_of_type(e3,power) &&
-                 e3.op(0).is_equal(numeric(5)) &&
-                 e3.op(1).is_equal(numeric(1,2)))) {
+             e3.op(0).is_equal(numeric(5)) &&
+             e3.op(1).is_equal(numeric(1,2)))) {
                clog << "5^(1/2) wrongly returned " << e3 << endl;
                return 1;
        }
@@ -277,7 +277,7 @@ static unsigned exam_powerlaws5(void)
        ex e2 = pow(0,a);
        if (!(is_ex_exactly_of_type(e2,power))) {
                clog << "0^a was evaluated to " << e2
-                        << " though nothing is known about a." << endl;
+                    << " though nothing is known about a." << endl;
                return 1;
        }
        
index 133f01b0ba728f9ac2efa245fb267406d673ade3..2e6c0e0b83ec3e139c7f3e0e35ebfa97c61f5657 100644 (file)
@@ -30,8 +30,8 @@ static unsigned check_series(const ex &e, const ex &point, const ex &d, int orde
        ex ep = ex_to_pseries(es).convert_to_poly();
        if (!(ep - d).is_zero()) {
                clog << "series expansion of " << e << " at " << point
-                        << " erroneously returned " << ep << " (instead of " << d
-                        << ")" << endl;
+                    << " erroneously returned " << ep << " (instead of " << d
+                    << ")" << endl;
                (ep-d).printtree(clog);
                return 1;
        }
@@ -152,30 +152,30 @@ static unsigned exam_series5(void)
 {
        ex e = tgamma(2*x);
        ex d = pow(x+1,-1)*numeric(1,4) +
-                  pow(x+1,0)*(numeric(3,4) -
-                                          numeric(1,2)*Euler) +
-                  pow(x+1,1)*(numeric(7,4) -
-                                          numeric(3,2)*Euler +
-                                          numeric(1,2)*pow(Euler,2) +
-                                          numeric(1,12)*pow(Pi,2)) +
-                  pow(x+1,2)*(numeric(15,4) -
-                                          numeric(7,2)*Euler -
-                                          numeric(1,3)*pow(Euler,3) +
-                                          numeric(1,4)*pow(Pi,2) +
-                                          numeric(3,2)*pow(Euler,2) -
-                                          numeric(1,6)*pow(Pi,2)*Euler -
-                                          numeric(2,3)*zeta(3)) +
-                  pow(x+1,3)*(numeric(31,4) - pow(Euler,3) -
-                                          numeric(15,2)*Euler +
-                                          numeric(1,6)*pow(Euler,4) +
-                                          numeric(7,2)*pow(Euler,2) +
-                                          numeric(7,12)*pow(Pi,2) -
-                                          numeric(1,2)*pow(Pi,2)*Euler -
-                                          numeric(2)*zeta(3) +
-                                          numeric(1,6)*pow(Euler,2)*pow(Pi,2) +
-                                          numeric(1,40)*pow(Pi,4) +
-                                          numeric(4,3)*zeta(3)*Euler) +
-                  Order(pow(x+1,4));
+              pow(x+1,0)*(numeric(3,4) -
+                          numeric(1,2)*Euler) +
+              pow(x+1,1)*(numeric(7,4) -
+                          numeric(3,2)*Euler +
+                          numeric(1,2)*pow(Euler,2) +
+                          numeric(1,12)*pow(Pi,2)) +
+              pow(x+1,2)*(numeric(15,4) -
+                          numeric(7,2)*Euler -
+                          numeric(1,3)*pow(Euler,3) +
+                          numeric(1,4)*pow(Pi,2) +
+                          numeric(3,2)*pow(Euler,2) -
+                          numeric(1,6)*pow(Pi,2)*Euler -
+                          numeric(2,3)*zeta(3)) +
+              pow(x+1,3)*(numeric(31,4) - pow(Euler,3) -
+                          numeric(15,2)*Euler +
+                          numeric(1,6)*pow(Euler,4) +
+                          numeric(7,2)*pow(Euler,2) +
+                          numeric(7,12)*pow(Pi,2) -
+                          numeric(1,2)*pow(Pi,2)*Euler -
+                          numeric(2)*zeta(3) +
+                          numeric(1,6)*pow(Euler,2)*pow(Pi,2) +
+                          numeric(1,40)*pow(Pi,4) +
+                          numeric(4,3)*zeta(3)*Euler) +
+              Order(pow(x+1,4));
        return check_series(e, -1, d, 4);
 }
        
@@ -184,8 +184,8 @@ static unsigned exam_series6(void)
 {
        ex e = tan(x*Pi/2);
        ex d = pow(x-1,-1)/Pi*(-2) + pow(x-1,1)*Pi/6 + pow(x-1,3)*pow(Pi,3)/360
-                 +pow(x-1,5)*pow(Pi,5)/15120 + pow(x-1,7)*pow(Pi,7)/604800
-                 +Order(pow(x-1,8));
+             +pow(x-1,5)*pow(Pi,5)/15120 + pow(x-1,7)*pow(Pi,7)/604800
+             +Order(pow(x-1,8));
        return check_series(e,1,d,8);
 }
 
@@ -194,7 +194,7 @@ static unsigned exam_series7(void)
 {
        ex e = log(sin(x));
        ex d = log(x) - pow(x,2)/6 - pow(x,4)/180 - pow(x,6)/2835
-                 +Order(pow(x,8));
+             +Order(pow(x,8));
        return check_series(e,0,d,8);
 }
 
@@ -203,8 +203,8 @@ static unsigned exam_series8(void)
 {
        ex e = Li2(sin(x));
        ex d = x + pow(x,2)/4 - pow(x,3)/18 - pow(x,4)/48
-                  - 13*pow(x,5)/1800 - pow(x,6)/360 - 23*pow(x,7)/21168
-                  + Order(pow(x,8));
+              - 13*pow(x,5)/1800 - pow(x,6)/360 - 23*pow(x,7)/21168
+              + Order(pow(x,8));
        return check_series(e,0,d,8);
 }
 
@@ -213,10 +213,10 @@ static unsigned exam_series9(void)
 {
        ex e = Li2(pow(x,2));
        ex d = Li2(4) + (-log(3) + I*Pi*csgn(I-I*pow(x,2))) * (x-2)
-                  + (numeric(-2,3) + log(3)/4 - I*Pi/4*csgn(I-I*pow(x,2))) * pow(x-2,2)
-                  + (numeric(11,27) - log(3)/12 + I*Pi/12*csgn(I-I*pow(x,2))) * pow(x-2,3)
-                  + (numeric(-155,648) + log(3)/32 - I*Pi/32*csgn(I-I*pow(x,2))) * pow(x-2,4)
-                  + Order(pow(x-2,5));
+              + (numeric(-2,3) + log(3)/4 - I*Pi/4*csgn(I-I*pow(x,2))) * pow(x-2,2)
+              + (numeric(11,27) - log(3)/12 + I*Pi/12*csgn(I-I*pow(x,2))) * pow(x-2,3)
+              + (numeric(-155,648) + log(3)/32 - I*Pi/32*csgn(I-I*pow(x,2))) * pow(x-2,4)
+              + Order(pow(x-2,5));
        return check_series(e,2,d,5);
 }
 
index 01e8f25b9463241f0dc0693a61c30c3ac8a6f5bc..69f9d9a6b55ecb468429c078baefa43c07de7aae 100644 (file)
@@ -121,7 +121,7 @@ int main()
                        cout << "(" << result << " individual failures)" << endl;
                }
                cout << "please check exams.out against exams.ref for more details."
-                        << endl << "happy debugging!" << endl;
+                    << endl << "happy debugging!" << endl;
        }
        
        return result;
index e20fdded252f9c1d917f7c8bec1ca219fbbf5578..cbae278bf82ff28d5d903e411b45d67853cb6af1 100644 (file)
@@ -31,15 +31,20 @@ static unsigned expand_subs(unsigned size)
        unsigned result = 0;
        // create a vector of size symbols named "a0", "a1", ...
        vector<symbol> a;
+       ex e;
        for (unsigned i=0; i<size; ++i) {
+#if defined(HAVE_SSTREAM)
+               ostringstream buf;
+               buf << "a" << i << ends;
+               a.push_back(symbol(buf.str()));
+#else
                char buf[4];
-               ostrstream(buf,sizeof(buf)) << i << ends;
-               a.push_back(symbol(string("a")+buf));
+               ostrstream(buf,sizeof(buf)) << "a" << i << ends;
+               a.push_back(symbol(buf));
+#endif
+               e += a[i];
        }
-       ex e, aux;
-       
-       for (unsigned i=0; i<size; ++i)
-               e = e + a[i];
+       ex aux;
        
        // prepare aux so it will swallow anything but a1^2:
        aux = -e + a[0] + a[1];
@@ -47,7 +52,7 @@ static unsigned expand_subs(unsigned size)
        
        if (e != pow(a[1],2)) {
                clog << "Denny Fliegner's quick consistency check erroneously returned "
-                        << e << "." << endl;
+                    << e << "." << endl;
                ++result;
        }
        
index 59a08a9faeefd23b5a3ad5eaca6de62148f998df..682835782dea9d8414351832f3f173145eff51f5 100644 (file)
@@ -35,8 +35,8 @@ unsigned tgammaseries(unsigned order)
        ex bound = evalf(exp(ex(-.57721566490153286*(order-1)))/(order-1));
        if (evalf(abs((last_coeff-pow(-1,order))/bound)) > numeric(1)) {
                clog << "The " << order-1
-                        << "th order coefficient in the power series expansion of tgamma(0) was erroneously found to be "
-                        << last_coeff << ", violating a simple estimate." << endl;
+                    << "th order coefficient in the power series expansion of tgamma(0) was erroneously found to be "
+                    << last_coeff << ", violating a simple estimate." << endl;
                ++result;
        }
        
index ce2921c85fc754aa5cf832feaecad63b95461a13..dd86ee2442ae656fed37e4178d49dd75d2d3c9c1 100644 (file)
@@ -34,8 +34,8 @@ static unsigned test(void)
        ex lastgcd = gcd(pow(x,300+(200%181)),pow(y,200+(200%183)));
        if (lastgcd != numeric("53174994123961114423610399251974962981084780166115806651505844915220196792416194060680805428433601792982500430324916963290494659936522782673704312949880308677990050199363768068005367578752699785180694630122629259539608472261461289805919741933")) {
                clog << "gcd(" << x << "^" << 300+(200%181) << ","
-                        << y << "^" << 200+(200%183) << ") erroneously returned "
-                        << lastgcd << endl;
+                    << y << "^" << 200+(200%183) << ") erroneously returned "
+                    << lastgcd << endl;
                return 1;
        }
        return 0;
index 1bae9c88fa4ac50104ea003ff9e18d3bcfc9e522..efbf335d2085f46c9d30d355c6e3f2bee12ce00c 100644 (file)
@@ -30,9 +30,9 @@ static unsigned test(void)
        symbol z("z");
 
        ex p = expand(pow(7*y*pow(x*z,2)-3*x*y*z+11*(x+1)*pow(y,2)+5*z+1,4)
-                                 *pow(3*x-7*y+2*z-3,5));
+                     *pow(3*x-7*y+2*z-3,5));
        ex q = expand(pow(7*y*pow(x*z,2)-3*x*y*z+11*(x+1)*pow(y,2)+5*z+1,3)
-                                 *pow(3*x-7*y+2*z+3,6));
+                     *pow(3*x-7*y+2*z+3,6));
        ex result = gcd(p,q);
        if (result.expand()!=expand(pow(7*y*pow(x*z,2)-3*x*y*z+11*(x+1)*pow(y,2)+5*z+1,3))) {
                clog << "gcd(expand((7*y*x^2*z^2-3*x*y*z+11*(x+1)*y^2+5*z+1)^4*(3*x-7*y+2*z-3)^5),expand((7*y*x^2*z^2-3*x*y*z+11*(x+1)*y^2+5*z+1)^3*(3*x-7*y+2*z+3)^6)) erroneously returned " << result << endl;
index 41c077025541e8531c5c2057674a7425b44be4bd..63db155b2762c08676576dbca52e2cd30da5cc95 100644 (file)
@@ -30,9 +30,9 @@ static unsigned test(unsigned n)
        char name = (n==40?'I':(n==70?'K':'?'));
        
        cout << "timing Lewis-Wester test " << name
-                << " (invert rank " << n << " Hilbert)" << flush;
+            << " (invert rank " << n << " Hilbert)" << flush;
        clog << "-------Lewis-Wester test " << name
-                << " (invert rank " << n << " Hilbert)" << endl;
+            << " (invert rank " << n << " Hilbert)" << endl;
        
        // Create a rank n Hilbert matrix:
        matrix H(n,n);
@@ -51,9 +51,9 @@ static unsigned test(unsigned n)
        name = (n==40?'J':(n==70?'L':'?'));
        
        cout << "timing Lewis-Wester test " << name
-                << " (check rank " << n << " Hilbert)" << flush;
+            << " (check rank " << n << " Hilbert)" << flush;
        clog << "-------Lewis-Wester test " << name
-                << " (check rank " << n << " Hilbert)" << endl;
+            << " (check rank " << n << " Hilbert)" << endl;
        
        cartier.reset();
        matrix identity = H.mul(Hinv);
index 8848f42f3e802081a73bc54bb415e08cd48de149..6ef9dcbe325f3c112070a111b163865070e0faf9 100644 (file)
@@ -59,8 +59,8 @@ static unsigned test(void)
        for (unsigned r=0; r<26; ++r) {
                for (unsigned c=0; c<5; ++c) {
                        m.set(r,
-                                 unsigned(ex_to_numeric(w[r][2*c+1]).to_int()-1),
-                                 w[r][2*c+2]);
+                             unsigned(ex_to_numeric(w[r][2*c+1]).to_int()-1),
+                             w[r][2*c+2]);
                }
        }
        ex det = m.determinant();
index 1fa918681e5806278f0e90cc21a11b1ff85e5cb2..8edda41faf7996cb78159b513ab9149a6cfc9d5a 100644 (file)
@@ -30,13 +30,13 @@ static unsigned toeplitz_det(unsigned size)
        unsigned result = 0;
        symbol a("a"), b("b");
        ex p[8] = {a,
-                          b,
-                          a+b,
-                          pow(a,2) + a*b + pow(b,2),
-                          pow(a,3) + pow(a,2)*b - a*pow(b,2) + pow(b,3),
-                          pow(a,4) + pow(a,3)*b + pow(a*b,2) + a*pow(b,3) + pow(b,4),
-                          pow(a,5) + pow(a,4)*b + pow(a,3)*pow(b,2) - pow(a,2)*pow(b,3) + a*pow(b,4) + pow(b,5),
-                          pow(a,6) + pow(a,5)*b + pow(a,4)*pow(b,2) + pow(a*b,3) + pow(a,2)*pow(b,4) + a*pow(b,5) + pow(b,6)
+                  b,
+                  a+b,
+                  pow(a,2) + a*b + pow(b,2),
+                  pow(a,3) + pow(a,2)*b - a*pow(b,2) + pow(b,3),
+                  pow(a,4) + pow(a,3)*b + pow(a*b,2) + a*pow(b,3) + pow(b,4),
+                  pow(a,5) + pow(a,4)*b + pow(a,3)*pow(b,2) - pow(a,2)*pow(b,3) + a*pow(b,4) + pow(b,5),
+                  pow(a,6) + pow(a,5)*b + pow(a,4)*pow(b,2) + pow(a*b,3) + pow(a,2)*pow(b,4) + a*pow(b,5) + pow(b,6)
        };
        
        // construct Toeplitz matrix:
@@ -54,8 +54,8 @@ static unsigned toeplitz_det(unsigned size)
        // dirty consistency check of result:
        if (!tdet.subs(a==0).subs(b==0).is_zero()) {
                clog << "Determaint of Toeplitz matrix " << endl
-                        << "M==" << M << endl
-                        << "was miscalculated: det(M)==" << tdet << endl;
+                    << "M==" << M << endl
+                    << "was miscalculated: det(M)==" << tdet << endl;
                ++result;
        }
        
index 69f8934a44d66801f5839928c157d598123e7a0b..6473856957c2f857b70a9f310767b22aff4abb94 100644 (file)
@@ -48,8 +48,8 @@ static unsigned vandermonde_det(unsigned size)
        // dirty consistency check of result:
        if (!vdet.subs(a==1).is_zero()) {
                clog << "Determaint of Vandermonde matrix " << endl
-                        << "M==" << M << endl
-                        << "was miscalculated: det(M)==" << vdet << endl;
+                    << "M==" << M << endl
+                    << "was miscalculated: det(M)==" << vdet << endl;
                ++result;
        }
        
index 19031dd9c7b8ecdc1688b1c43518d07dc37d7c8a..14aaf18930abfaad1d2afd16db1eef7b310f7bc7 100644 (file)
@@ -170,7 +170,7 @@ int main()
                        cout << "(" << result << " individual failures)" << endl;
                }
                cout << "please check times.out against times.ref for more details."
-                        << endl << "happy debugging!" << endl;
+                    << endl << "happy debugging!" << endl;
        }
        
        return result;