MathTypeLibrary(libmath++)  0.0.3
utils.h
1 
2 // Math Type Library
3 // $Id: utils.h,v 1.5 2002/04/23 02:48:38 cparpart Exp $
4 // (This file contains the interface to some utility methods)
5 //
6 // Copyright (c) 2002 by Christian Parpart <cparpart@surakware.net>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public License
19 // along with this library; see the file COPYING.LIB. If not, write to
20 // the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 // Boston, MA 02111-1307, USA.
23 #ifndef libmath_utils_h
24 #define libmath_utils_h
25 
26 #include <vector>
27 #include <utility>
28 #include <string>
29 
30 namespace math {
31 
32 template<class> class TNode;
33 template<class> class TLibrary;
34 
38 bool isPrime(unsigned ANumber);
39 
44 unsigned primeCount(unsigned long long ANumber,
45  unsigned long long APrime);
46 
56 unsigned factorize(unsigned long long ANumber,
57  std::vector<std::pair<unsigned long long, unsigned long long> >& AResult);
58 
63 std::string factorize(unsigned long long ANumber);
64 
69 template<class T>
70 T calculate(const std::string& AExpression);
71 
75 template<class T>
76 T calculate(const std::string& AExpression, const TLibrary<T>&);
77 
82 template<class T>
83 TNode<T> *derive(const TNode<T> *AExpression, unsigned ACount = 1);
84 
89 template<class T>
90 TNode<T> *simplify(const TNode<T> *AExpression);
91 
96 template<class T>
97 TNode<T> *expand(const TNode<T> *AExpression);
98 
102 template<class T>
103 TNode<T> *copyOf(const TNode<T> *AExpression);
104 
108 template<class T>
109 TNode<T> *createTree(const std::string& AExprStr);
110 
114 template<class T>
115 TNode<T> *umkehrfunktion(const TNode<T> *ATree);
116 
120 template<class T>
121 TNode<T> *integral(const TNode<T> *ATree);
122 
123 } // namespace math
124 
125 #include <math++/utils.tcc>
126 
127 #endif