]> www.ginac.de Git - ginac.git/blobdiff - ginac/series.cpp
- modified the comment blocks so the copyright message no longer appears in
[ginac.git] / ginac / series.cpp
index 9daf656b1a8facb92739e41bda51c5fbf372848a..6002d95b2c86f4c62ea7da70554f54ac251cc8a7 100644 (file)
@@ -3,14 +3,38 @@
  *  Implementation of class for extended truncated power-series and
  *  methods for series expansion. */
 
-#include "ginac.h"
+/*
+ *  GiNaC Copyright (C) 1999 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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "series.h"
+#include "add.h"
+#include "inifcns.h"
+#include "mul.h"
+#include "power.h"
+#include "relational.h"
+#include "symbol.h"
 
 
 /*
  *  Default constructor, destructor, copy constructor, assignment operator and helpers
  */
 
-series::series() : basic(TINFO_SERIES)
+series::series() : basic(TINFO_series)
 {
     debugmsg("series default constructor", LOGLEVEL_CONSTRUCT);
 }
@@ -67,7 +91,7 @@ void series::destroy(bool call_parent)
  *  @param ops_  vector of {coefficient, power} pairs (coefficient must not be zero)
  *  @return newly constructed series */
 series::series(ex const &var_, ex const &point_, epvector const &ops_)
-    : basic(TINFO_SERIES), seq(ops_), var(var_), point(point_)
+    : basic(TINFO_series), seq(ops_), var(var_), point(point_)
 {
     debugmsg("series constructor from ex,ex,epvector", LOGLEVEL_CONSTRUCT);
     ASSERT(is_ex_exactly_of_type(var_, symbol));
@@ -87,7 +111,7 @@ basic *series::duplicate() const
 // Highest degree of variable
 int series::degree(symbol const &s) const
 {
-    if (var == s) {
+    if (var.is_equal(s)) {
         // Return last exponent
         if (seq.size())
             return ex_to_numeric((*(seq.end() - 1)).coeff).to_int();
@@ -111,7 +135,7 @@ int series::degree(symbol const &s) const
 // Lowest degree of variable
 int series::ldegree(symbol const &s) const
 {
-    if (var == s) {
+    if (var.is_equal(s)) {
         // Return first exponent
         if (seq.size())
             return ex_to_numeric((*(seq.begin())).coeff).to_int();
@@ -135,7 +159,7 @@ int series::ldegree(symbol const &s) const
 // Coefficient of variable
 ex series::coeff(symbol const &s, int n) const
 {
-    if (var == s) {
+    if (var.is_equal(s)) {
         epvector::const_iterator it = seq.begin(), itend = seq.end();
         while (it != itend) {
             int pow = ex_to_numeric(it->coeff).to_int();
@@ -295,7 +319,7 @@ ex series::add_series(const series &other) const
                 break;  // Order term ends the sequence
             } else {
                 ex sum = (*a).rest + (*b).rest;
-                if (!(sum == exZERO()))
+                if (!(sum.is_zero()))
                     new_seq.push_back(expair(sum, numeric(pow_a)));
                 a++;
                 b++;