]> www.ginac.de Git - ginac.git/commitdiff
Merge branch 'master' of git://ffmssmsc.jinr.ru:443/varg/ginac
authorJens Vollinga <jensv@nikhef.nl>
Tue, 9 Sep 2008 20:42:50 +0000 (22:42 +0200)
committerJens Vollinga <jensv@nikhef.nl>
Tue, 9 Sep 2008 20:42:50 +0000 (22:42 +0200)
NEWS
check/exam_factor.cpp
ginac/factor.cpp

diff --git a/NEWS b/NEWS
index d2891a3626f9eb949887dce988f13b8639272ea4..cd011391c89dbf1633d25e6738fb1a20fdbee1dd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,45 @@
 This file records noteworthy changes.
 
 1.5.0 (<date>)
+* Added polynomial factorization.
+* Added an additional (recursive descent) expression parser.
+* gcd now allows the user to override (some of the) heuristics.
 * Improved lsolve() of systems containing non-numeric coefficients.
+* Removed implicit conversions from cl_N to numeric.
+
+1.4.4 (<DATE>)
+* Fixed a bug in the multiple polylogarithms Li/G that caused imaginary parts
+  of the arguments to be ignored. 
+* Fixed archiving of complex numbers.
+* Made the behaviour of class function more consistent with respect to
+  ncmul::eval().
+* Improved heur_gcd() so it can handle rational polynomials.
+
+1.4.3 (04 April 2008)
+* Fixed bug in numerical evaluation of multiple polylogarithms and
+  alternating multiple zeta values introduced in version 1.4.2.
+* Nielsen polylog now invalidates its lookup tables in case the precision
+  (Digits) has been changed.
+* Added new checks for recent bugs in the numerical evaluation of Li and zeta.
+
+1.4.2 (03 April 2008)
+* Fixed VPATH building of documentation.
+* Fixed bug in numerical evaluation of multiple polylogarithms for arguments
+  equal to certain roots of unity (thanks to Jianqiang Zhao).
+* Fixed check for memory leakage in parser.
+* Made internal function coerce() standard compliant.
+* Improved lsolve() of systems containing non-numeric coefficients.
+* Improved automatic test programs. Now they work on MinGW and Cygwin as well.
+
+1.4.1 (21 November 2007)
+* Fixed memory leak in ginac_yylex().
+* Fixed memory leaks in mul::eval() and power::eval().
+* Fixed macro checking for version of libreadline (Mac OS X).
+* Fixed broken preprocessor instruction in excompiler.cpp.
+* Fixed broken module loading in excompiler.cpp.
+* info(info_flags::has_indices) now works for sums and products.
+* Improved mul::expand().
+* Improved CLN output.
 
 1.4.0 (31 August 2007)
 * New tinfo mechanism.
index fa895c6dc06d7fc521e533ec604f443bd1c36d34..e3552bfcdd8e0aaa1cd7f8ccb4f5f065e4269582 100644 (file)
@@ -101,6 +101,29 @@ static unsigned exam_factor1()
        e = ex("(1+4*x)*x^2*(1-4*x+16*x^2)*(3+5*x+92*x^3)", syms);
        result += check_factor(e);
 
+       e = ex("(77+11*x^3+25*x^2+27*x+102*x^4)*(85+57*x^3+92*x^2+29*x+66*x^4)", syms);
+       result += check_factor(e);
+
+       return result;
+}
+
+static unsigned exam_factor2()
+{
+       unsigned result = 0;
+       ex e, d;
+       symbol x("x"), y("y"), z("z");
+       lst syms;
+       syms = x, y, z;
+       
+       e = ex("x+y", syms);
+       result += check_factor(e);
+
+       e = ex("x+y", syms);
+       result += check_factor(e);
+
+       e = ex("-2*(x+y)*(x-y)", syms);
+       result += check_factor(e);
+
        return result;
 }
 
@@ -111,6 +134,7 @@ unsigned exam_factor()
        cout << "examining polynomial factorization" << flush;
 
        result += exam_factor1(); cout << '.' << flush;
+       result += exam_factor2(); cout << '.' << flush;
 
        return result;
 }
index 886819a395efc6ef2c273bb139836e2761ab7339..73e7d6c1f9bb35a5d08d4dfe62f78e2d9f0247a4 100644 (file)
@@ -124,8 +124,8 @@ struct UniPoly
                // assert: poly is in Z[x]
                Term t;
                for ( int i=poly.degree(x); i>=poly.ldegree(x); --i ) {
-                       int coeff = ex_to<numeric>(poly.coeff(x,i)).to_int();
-                       if ( coeff ) {
+                       cl_I coeff = the<cl_I>(ex_to<numeric>(poly.coeff(x,i)).to_cl_N());
+                       if ( !zerop(coeff) ) {
                                t.c = R->canonhom(coeff);
                                if ( !zerop(t.c) ) {
                                        t.exp = i;
@@ -1057,7 +1057,7 @@ static ex hensel_univar(const ex& a_, const ex& x, unsigned int p, const UniPoly
        if ( gamma == 0 ) {
                gamma = alpha;
        }
-       unsigned int gamma_ui = ex_to<numeric>(abs(gamma)).to_int();
+       numeric gamma_ui = ex_to<numeric>(abs(gamma));
        a = a * gamma;
        UniPoly nu1 = u1_;
        nu1.unit_normal();
@@ -1078,7 +1078,7 @@ static ex hensel_univar(const ex& a_, const ex& x, unsigned int p, const UniPoly
        ex w = replace_lc(w1.to_ex(x), x, alpha);
        ex e = expand(a - u * w);
        numeric modulus = p;
-       const numeric maxmodulus(2*B*gamma_ui);
+       const numeric maxmodulus = 2*numeric(B)*gamma_ui;
 
        // step 4
        while ( !e.is_zero() && modulus < maxmodulus ) {
@@ -1966,7 +1966,8 @@ static ex factor_multivariate(const ex& poly, const exset& syms)
 
        /* factor leading coefficient */
        pp = pp.collect(x);
-       ex vn = p.lcoeff(x);
+       ex vn = pp.lcoeff(x);
+       pp = pp.expand();
        ex vnlst;
        if ( is_a<numeric>(vn) ) {
                vnlst = lst(vn);
@@ -2152,9 +2153,15 @@ static ex factor_multivariate(const ex& poly, const exset& syms)
                                maxdegree = uvec[i].degree();
                        }
                }
-               unsigned int B = cl_I_to_uint(normmc * expt_pos(cl_I(2), maxdegree));
+               cl_I B = normmc * expt_pos(cl_I(2), maxdegree);
+               cl_I l = 1;
+               cl_I pl = prime;
+               while ( pl < B ) {
+                       l += 1;
+                       pl = pl * prime;
+               }
 
-               ex res = hensel_multivar(poly, x, epv, prime, B, uvec, C);
+               ex res = hensel_multivar(pp, x, epv, prime, l, uvec, C);
                if ( res != lst() ) {
                        ex result = cont;
                        for ( size_t i=0; i<res.nops(); ++i ) {