3 * Interface to GiNaC's constant types and some special constants.
5 * GiNaC Copyright (C) 1999 Johannes Gutenberg University Mainz, Germany
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #ifndef __GINAC_CONSTANT_H__
23 #define __GINAC_CONSTANT_H__
26 #include <ginac/basic.h>
28 /** This class holds constants, symbols with specific numerical value. Each
29 * object of this class must either provide their own function to evaluate it
30 * to class numeric or provide the constant as a numeric (if it's an exact
32 class constant : public basic
37 // default constructor, destructor, copy constructor assignment operator and helpers
40 constant(constant const & other);
41 // constant const & operator=(constant const & other); /* it's pervert! */
43 void copy(constant const & other);
44 void destroy(bool call_parent);
48 constant(string const & initname, ex (*efun)()=0);
49 constant(string const & initname, numeric const & initnumber);
51 // functions overriding virtual functions from bases classes
53 basic * duplicate() const;
54 void printraw(ostream & os) const;
55 void print(ostream & os, unsigned upper_precedence=0) const;
56 void printcsrc(ostream & os, unsigned type, unsigned upper_precedence=0) const;
57 ex evalf(int level=0) const;
58 ex diff(symbol const & s) const;
60 int compare_same_type(basic const & other) const;
61 bool is_equal_same_type(basic const & other) const;
63 // new virtual functions which can be overridden by derived classes
66 // non-virtual functions in this class
76 unsigned serial; //!< unique serial number for comparision
77 static unsigned next_serial;
82 extern const constant some_constant;
83 extern type_info const & typeid_constant;
85 // extern const numeric I;
86 extern const constant Pi;
87 extern const constant Catalan;
88 extern const constant EulerGamma;
90 #endif // ndef __GINAC_CONSTANT_H__