-void pseries::print(std::ostream &os, unsigned upper_precedence) const
-{
- debugmsg("pseries print", LOGLEVEL_PRINT);
- if (precedence<=upper_precedence) os << "(";
- // objects of type pseries must not have any zero entries, so the
- // trivial (zero) pseries needs a special treatment here:
- if (seq.size()==0)
- os << '0';
- for (epvector::const_iterator i=seq.begin(); i!=seq.end(); ++i) {
- // print a sign, if needed
- if (i!=seq.begin())
- os << '+';
- if (!is_order_function(i->rest)) {
- // print 'rest', i.e. the expansion coefficient
- if (i->rest.info(info_flags::numeric) &&
- i->rest.info(info_flags::positive)) {
- os << i->rest;
- } else
- os << "(" << i->rest << ')';
- // print 'coeff', something like (x-1)^42
- if (!i->coeff.is_zero()) {
- os << '*';
- if (!point.is_zero())
- os << '(' << var-point << ')';
- else
- os << var;
- if (i->coeff.compare(_ex1())) {
- os << '^';
- if (i->coeff.info(info_flags::negative))
- os << '(' << i->coeff << ')';
- else
- os << i->coeff;
- }
- }
- } else {
- os << Order(power(var-point,i->coeff));
- }
- }
- if (precedence<=upper_precedence) os << ")";
-}