- Apparently, in ~ 30% of calls to mul::expand the expression is monomial.
[ginac.git] / ginac / power.cpp
index 10de528d06ad9cf09381b4376f61ff433ca414f6..1b28b509ac4bd35ef4bbcf7777e40069bcf056f2 100644 (file)
@@ -772,6 +772,9 @@ tinfo_t power::return_type_tinfo() const
 
 ex power::expand(unsigned options) const
 {
+       if (is_a<symbol>(basis) && exponent.info(info_flags::integer))
+               return (new power(*this))->setflag(status_flags::dynallocated | status_flags::expanded);
+
        if (options == 0 && (flags & status_flags::expanded))
                return *this;