]> www.ginac.de Git - ginac.git/blobdiff - ginac/power.cpp
Alexei Sheplyakovs patch for making collect_common_factors also work with
[ginac.git] / ginac / power.cpp
index 69e3dd7fc968c4545381f8890c95b4cec6badf23..0ebc8dc29a20db47796cde8ab228eb293c76d3da 100644 (file)
@@ -258,6 +258,15 @@ ex power::map(map_function & f) const
                return *this;
 }
 
+bool power::is_polynomial(const ex & var) const
+{
+       if (exponent.has(var))
+               return false;
+       if (!exponent.info(info_flags::nonnegint))
+               return false;
+       return basis.is_polynomial(var);
+}
+
 int power::degree(const ex & s) const
 {
        if (is_equal(ex_to<basic>(s)))
@@ -611,7 +620,7 @@ ex power::conjugate() const
  *  @see ex::diff */
 ex power::derivative(const symbol & s) const
 {
-       if (exponent.info(info_flags::real)) {
+       if (is_a<numeric>(exponent)) {
                // D(b^r) = r * b^(r-1) * D(b) (faster than the formula below)
                epvector newseq;
                newseq.reserve(2);
@@ -643,7 +652,7 @@ unsigned power::return_type() const
        return basis.return_type();
 }
 
-const basic* power::return_type_tinfo() const
+tinfo_t power::return_type_tinfo() const
 {
        return basis.return_type_tinfo();
 }