]> www.ginac.de Git - ginac.git/blobdiff - ginac/symbol.cpp
info_flags::expanded added [A.Sheplyakov]
[ginac.git] / ginac / symbol.cpp
index 10b38a8eb71f8750e4671a2742db328bf9d62da8..9f3b1c62df576c4afeaa04f68ed58f9ff6ee978e 100644 (file)
@@ -3,7 +3,7 @@
  *  Implementation of GiNaC's symbolic objects. */
 
 /*
- *  GiNaC Copyright (C) 1999-2006 Johannes Gutenberg University Mainz, Germany
+ *  GiNaC Copyright (C) 1999-2007 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
@@ -57,6 +57,13 @@ realsymbol::realsymbol()
        domain = domain::real;
 }
 
+// possymbol
+
+possymbol::possymbol()
+{
+       domain = domain::positive;
+}
+
 //////////
 // other constructors
 //////////
@@ -103,6 +110,20 @@ realsymbol::realsymbol(const std::string & initname, unsigned rt, tinfo_t rtt, u
 realsymbol::realsymbol(const std::string & initname, const std::string & texname, unsigned rt, tinfo_t rtt, unsigned domain)
  : symbol(initname, texname, rt, rtt, domain) { }
 
+// possymbol
+       
+possymbol::possymbol(const std::string & initname, unsigned domain)
+ : symbol(initname, domain) { }
+
+possymbol::possymbol(const std::string & initname, const std::string & texname, unsigned domain)
+ : symbol(initname, texname, domain) { }
+
+possymbol::possymbol(const std::string & initname, unsigned rt, tinfo_t rtt, unsigned domain)
+ : symbol(initname, rt, rtt, domain) { }
+
+possymbol::possymbol(const std::string & initname, const std::string & texname, unsigned rt, tinfo_t rtt, unsigned domain)
+ : symbol(initname, texname, rt, rtt, domain) { }
+
 //////////
 // archiving
 //////////
@@ -193,10 +214,13 @@ bool symbol::info(unsigned inf) const
            inf == info_flags::cinteger_polynomial ||
            inf == info_flags::rational_polynomial ||
            inf == info_flags::crational_polynomial ||
-           inf == info_flags::rational_function)
+           inf == info_flags::rational_function ||
+                       inf == info_flags::expanded)
                return true;
        if (inf == info_flags::real)
-               return domain == domain::real;
+               return domain==domain::real || domain==domain::positive;
+       if (inf == info_flags::positive || inf == info_flags::nonnegative)
+               return domain == domain::positive;
        else
                return inherited::info(inf);
 }
@@ -220,12 +244,26 @@ ex symbol::eval(int level) const
 ex symbol::conjugate() const
 {
        if (this->domain == domain::complex) {
-               return GiNaC::conjugate_function(*this).hold();
+               return conjugate_function(*this).hold();
        } else {
                return *this;
        }
 }
 
+ex symbol::real_part() const
+{
+       if (domain==domain::real || domain==domain::positive)
+               return *this;
+       return real_part_function(*this).hold();
+}
+
+ex symbol::imag_part() const
+{
+       if (domain==domain::real || domain==domain::positive)
+               return 0;
+       return imag_part_function(*this).hold();
+}
+
 bool symbol::is_polynomial(const ex & var) const
 {
        return true;