* methods for series expansion. */
/*
- * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
var.print(c, level + delta_indent);
point.print(c, level + delta_indent);
+ } else if (is_a<print_python_repr>(c)) {
+ c.s << class_name() << "(relational(";
+ var.print(c);
+ c.s << ',';
+ point.print(c);
+ c.s << "),[";
+ unsigned num = seq.size();
+ for (unsigned i=0; i<num; ++i) {
+ if (i)
+ c.s << ',';
+ c.s << '(';
+ seq[i].rest.print(c);
+ c.s << ',';
+ seq[i].coeff.print(c);
+ c.s << ')';
+ }
+ c.s << "])";
} else {
if (precedence() <= level)
} else
var.print(c);
if (i->coeff.compare(_ex1)) {
- c.s << '^';
+ if (is_a<print_python>(c))
+ c.s << "**";
+ else
+ c.s << '^';
if (i->coeff.info(info_flags::negative)) {
c.s << par_open;
i->coeff.print(c);
->setflag(status_flags::dynallocated | (options == 0 ? status_flags::expanded : 0));
}
-/** Implementation of ex::diff() for a power series. It treats the series as a
- * polynomial.
+/** Implementation of ex::diff() for a power series.
* @see ex::diff */
ex pseries::derivative(const symbol & s) const
{
+ epvector new_seq;
+ epvector::const_iterator it = seq.begin(), itend = seq.end();
+
if (s == var) {
- epvector new_seq;
- epvector::const_iterator it = seq.begin(), itend = seq.end();
// FIXME: coeff might depend on var
while (it != itend) {
}
++it;
}
- return pseries(relational(var,point), new_seq);
+
} else {
- return *this;
+
+ while (it != itend) {
+ if (is_order_function(it->rest)) {
+ new_seq.push_back(*it);
+ } else {
+ ex c = it->rest.diff(s);
+ if (!c.is_zero())
+ new_seq.push_back(expair(c, it->coeff));
+ }
+ ++it;
+ }
}
+
+ return pseries(relational(var,point), new_seq);
}
ex pseries::convert_to_poly(bool no_order) const