- if (precedence<=upper_precedence) os << "(";
- for (epvector::const_iterator i=seq.begin(); i!=seq.end(); ++i) {
- // omit zero terms
- if (i->rest.is_zero())
- continue;
- // 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 << ')';
+
+ if (is_a<print_tree>(c)) {
+
+ c.s << std::string(level, ' ') << class_name()
+ << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
+ << std::endl;
+ unsigned delta_indent = static_cast<const print_tree &>(c).delta_indent;
+ unsigned num = seq.size();
+ for (unsigned i=0; i<num; ++i) {
+ seq[i].rest.print(c, level + delta_indent);
+ seq[i].coeff.print(c, level + delta_indent);
+ c.s << std::string(level + delta_indent, ' ') << "-----" << std::endl;
+ }
+ var.print(c, level + delta_indent);
+ point.print(c, level + delta_indent);
+
+ } else {
+
+ if (precedence() <= level)
+ c.s << "(";
+
+ std::string par_open = is_a<print_latex>(c) ? "{(" : "(";
+ std::string par_close = is_a<print_latex>(c) ? ")}" : ")";
+
+ // objects of type pseries must not have any zero entries, so the
+ // trivial (zero) pseries needs a special treatment here:
+ if (seq.empty())
+ c.s << '0';
+ epvector::const_iterator i = seq.begin(), end = seq.end();
+ while (i != end) {
+ // print a sign, if needed
+ if (i != seq.begin())
+ c.s << '+';
+ 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)) {
+ i->rest.print(c);
+ } else {
+ c.s << par_open;
+ i->rest.print(c);
+ c.s << par_close;
+ }
+ // print 'coeff', something like (x-1)^42
+ if (!i->coeff.is_zero()) {
+ if (is_a<print_latex>(c))
+ c.s << ' ';