Math Type Library (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
30namespace math {
31
32template<class> class TNode;
33template<class> class TLibrary;
34
38bool isPrime(unsigned ANumber);
39
44unsigned primeCount(unsigned long long ANumber,
45 unsigned long long APrime);
46
56unsigned factorize(unsigned long long ANumber,
57 std::vector<std::pair<unsigned long long, unsigned long long> >& AResult);
58
63std::string factorize(unsigned long long ANumber);
64
69template<class T>
70T calculate(const std::string& AExpression);
71
75template<class T>
76T calculate(const std::string& AExpression, const TLibrary<T>&);
77
82template<class T>
83TNode<T> *derive(const TNode<T> *AExpression, unsigned ACount = 1);
84
89template<class T>
90TNode<T> *simplify(const TNode<T> *AExpression);
91
96template<class T>
97TNode<T> *expand(const TNode<T> *AExpression);
98
102template<class T>
103TNode<T> *copyOf(const TNode<T> *AExpression);
104
108template<class T>
109TNode<T> *createTree(const std::string& AExprStr);
110
114template<class T>
115TNode<T> *umkehrfunktion(const TNode<T> *ATree);
116
120template<class T>
121TNode<T> *integral(const TNode<T> *ATree);
122
123} // namespace math
124
125#include <math++/utils.tcc>
126
127#endif