GiNaC  1.6.2
constant.h
Go to the documentation of this file.
00001 
00005 /*
00006  *  GiNaC Copyright (C) 1999-2011 Johannes Gutenberg University Mainz, Germany
00007  *
00008  *  This program is free software; you can redistribute it and/or modify
00009  *  it under the terms of the GNU General Public License as published by
00010  *  the Free Software Foundation; either version 2 of the License, or
00011  *  (at your option) any later version.
00012  *
00013  *  This program is distributed in the hope that it will be useful,
00014  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *  GNU General Public License for more details.
00017  *
00018  *  You should have received a copy of the GNU General Public License
00019  *  along with this program; if not, write to the Free Software
00020  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021  */
00022 
00023 #ifndef GINAC_CONSTANT_H
00024 #define GINAC_CONSTANT_H
00025 
00026 #include "basic.h"
00027 #include "ex.h"
00028 #include "archive.h"
00029 
00030 #include <string>
00031 
00032 namespace GiNaC {
00033 
00034 typedef ex (*evalffunctype)();
00035     
00040 class constant : public basic
00041 {
00042     GINAC_DECLARE_REGISTERED_CLASS(constant, basic)
00043     // other constructors
00044 public:
00045     constant(const std::string & initname, evalffunctype efun = 0, const std::string & texname = std::string(), unsigned domain = domain::complex);
00046     constant(const std::string & initname, const numeric & initnumber, const std::string & texname = std::string(), unsigned domain = domain::complex);
00047     
00048     // functions overriding virtual functions from base classes
00049 public:
00050     bool info(unsigned inf) const;
00051     ex evalf(int level = 0) const;
00052     bool is_polynomial(const ex & var) const;
00053     ex conjugate() const;
00054     ex real_part() const;
00055     ex imag_part() const;
00056     void archive(archive_node& n) const;
00057     void read_archive(const archive_node& n, lst& syms);
00058 protected:
00059     ex derivative(const symbol & s) const;
00060     bool is_equal_same_type(const basic & other) const;
00061     unsigned calchash() const;
00062     
00063     // non-virtual functions in this class
00064 protected:
00065     void do_print(const print_context & c, unsigned level) const;
00066     void do_print_tree(const print_tree & c, unsigned level) const;
00067     void do_print_latex(const print_latex & c, unsigned level) const;
00068     void do_print_python_repr(const print_python_repr & c, unsigned level) const;
00069 
00070 // member variables
00071 private:
00072     std::string name;     
00073     std::string TeX_name; 
00074     evalffunctype ef;
00075     ex number;            
00076     unsigned serial;      
00077     static unsigned next_serial;
00078     unsigned domain;      
00079 };
00080 GINAC_DECLARE_UNARCHIVER(constant); 
00081 
00082 extern const constant Pi;
00083 extern const constant Catalan;
00084 extern const constant Euler;
00085 
00086 } // namespace GiNaC
00087 
00088 #endif // ndef GINAC_CONSTANT_H

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.