]> www.ginac.de Git - ginac.git/blobdiff - ginac/inifcns.cpp
Univariate Hensel lifting now uses upoly.
[ginac.git] / ginac / inifcns.cpp
index c49fc7021aa5694c1862d8ff743ac9f7936b60e6..17a080c9c35973a852255a1c1dc352f0e4f88159 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's initially known functions. */
 
 /*
- *  GiNaC Copyright (C) 1999-2005 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2008 Johannes Gutenberg University Mainz, Germany
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -190,8 +190,14 @@ static ex abs_eval(const ex & arg)
 {
        if (is_exactly_a<numeric>(arg))
                return abs(ex_to<numeric>(arg));
-       else
-               return abs(arg).hold();
+
+       if (arg.info(info_flags::nonnegative))
+               return arg;
+
+       if (is_ex_the_function(arg, abs))
+               return arg;
+
+       return abs(arg).hold();
 }
 
 static void abs_print_latex(const ex & arg, const print_context & c)
@@ -878,7 +884,7 @@ ex lsolve(const ex &eqns, const ex &symbols, unsigned options)
        
        // syntax checks
        if (!eqns.info(info_flags::list)) {
-               throw(std::invalid_argument("lsolve(): 1st argument must be a list"));
+               throw(std::invalid_argument("lsolve(): 1st argument must be a list or an equation"));
        }
        for (size_t i=0; i<eqns.nops(); i++) {
                if (!eqns.op(i).info(info_flags::relation_equal)) {
@@ -886,7 +892,7 @@ ex lsolve(const ex &eqns, const ex &symbols, unsigned options)
                }
        }
        if (!symbols.info(info_flags::list)) {
-               throw(std::invalid_argument("lsolve(): 2nd argument must be a list"));
+               throw(std::invalid_argument("lsolve(): 2nd argument must be a list or a symbol"));
        }
        for (size_t i=0; i<symbols.nops(); i++) {
                if (!symbols.op(i).info(info_flags::symbol)) {