]> www.ginac.de Git - ginac.git/blobdiff - ginac/mul.cpp
- symbols can have a LaTeX name, e.g. symbol s("s", "\\sigma");
[ginac.git] / ginac / mul.cpp
index 27451f6b7e9b821c045aae29ff316ca45fc24442..75f74b4ba2cb7d06fc1ce969f4072ba7e4494618 100644 (file)
@@ -405,7 +405,16 @@ ex mul::evalf(int level) const
 
 ex mul::simplify_ncmul(const exvector & v) const
 {
-       throw(std::logic_error("mul::simplify_ncmul() should never have been called!"));
+       if (seq.size()==0) {
+               return inherited::simplify_ncmul(v);
+       }
+
+       // Find first noncommutative element and call its simplify_ncmul()
+       for (epvector::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit) {
+               if (cit->rest.return_type() == return_types::noncommutative)
+                       return cit->rest.simplify_ncmul(v);
+       }
+       return inherited::simplify_ncmul(v);
 }
 
 // protected