]> www.ginac.de Git - ginac.git/blobdiff - ginac/series.cpp
- ASSERT macro renamed to GINAC_ASSERT
[ginac.git] / ginac / series.cpp
index 9daf656b1a8facb92739e41bda51c5fbf372848a..a390dd1516c61c212156711d3b27dc2d2e11038b 100644 (file)
@@ -3,14 +3,41 @@
  *  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"
+#include "debugmsg.h"
+
+namespace GiNaC {
 
 
 /*
  *  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,10 +94,10 @@ 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));
+    GINAC_ASSERT(is_ex_exactly_of_type(var_, symbol));
 }
 
 
@@ -87,7 +114,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 +138,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 +162,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 +322,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++;
@@ -600,7 +627,7 @@ ex power::series(symbol const & s, ex const & point, int order) const
  *  @return an expression holding a series object */
 ex ex::series(symbol const &s, ex const &point, int order) const
 {
-    ASSERT(bp!=0);
+    GINAC_ASSERT(bp!=0);
     return bp->series(s, point, order);
 }
 
@@ -608,3 +635,5 @@ ex ex::series(symbol const &s, ex const &point, int order) const
 // Global constants
 const series some_series;
 type_info const & typeid_series = typeid(some_series);
+
+} // namespace GiNaC