]> www.ginac.de Git - ginac.git/blobdiff - ginac/basic.cpp
- prepared for 1.0.13 release
[ginac.git] / ginac / basic.cpp
index d77e7dc44fe3838f6e8c65765faa19fd583b8dd4..f625e92b342a39e3538fa397649d5fc836e7e237 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's ABC. */
 
 /*
- *  GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2003 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
@@ -236,19 +236,22 @@ ex basic::map(map_function & f) const
 /** Return degree of highest power in object s. */
 int basic::degree(const ex & s) const
 {
-       return 0;
+       return is_equal(ex_to<basic>(s)) ? 1 : 0;
 }
 
 /** Return degree of lowest power in object s. */
 int basic::ldegree(const ex & s) const
 {
-       return 0;
+       return is_equal(ex_to<basic>(s)) ? 1 : 0;
 }
 
 /** Return coefficient of degree n in object s. */
 ex basic::coeff(const ex & s, int n) const
 {
-       return n==0 ? *this : _ex0;
+       if (is_equal(ex_to<basic>(s)))
+               return n==1 ? _ex1 : _ex0;
+       else
+               return n==0 ? *this : _ex0;
 }
 
 /** Sort expanded expression in terms of powers of some object(s).