]> www.ginac.de Git - ginac.git/blob - ginac/fderivative.h
Finalize 1.7.6 release.
[ginac.git] / ginac / fderivative.h
1 /** @file fderivative.h
2  *
3  *  Interface to abstract derivatives of functions. */
4
5 /*
6  *  GiNaC Copyright (C) 1999-2019 Johannes Gutenberg University Mainz, Germany
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program 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
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #ifndef GINAC_FDERIVATIVE_H
24 #define GINAC_FDERIVATIVE_H
25
26 #include "function.h"
27
28 #include <set>
29
30 namespace GiNaC {
31
32 typedef std::multiset<unsigned> paramset;
33
34 /** This class represents the (abstract) derivative of a symbolic function.
35  *  It is used to represent the derivatives of functions that do not have
36  *  a derivative or series expansion procedure defined. */
37 class fderivative : public function
38 {
39         GINAC_DECLARE_REGISTERED_CLASS(fderivative, function)
40
41         // other constructors
42 public:
43         /** Construct derivative with respect to one parameter.
44          *
45          *  @param ser Serial number of function
46          *  @param param Number of parameter with respect to which to take the derivative
47          *  @param args Arguments of derivative function */
48         fderivative(unsigned ser, unsigned param, const exvector & args);
49
50         /** Construct derivative with respect to multiple parameters.
51          *
52          *  @param ser Serial number of function
53          *  @param params Set of numbers of parameters with respect to which to take the derivative
54          *  @param args Arguments of derivative function */
55         fderivative(unsigned ser, const paramset & params, const exvector & args);
56
57         // internal constructors
58         fderivative(unsigned ser, const paramset & params, exvector && v);
59
60         // functions overriding virtual functions from base classes
61 public:
62         void print(const print_context & c, unsigned level = 0) const override;
63         ex eval() const override;
64         ex series(const relational & r, int order, unsigned options = 0) const override;
65         ex thiscontainer(const exvector & v) const override;
66         ex thiscontainer(exvector && v) const override;
67         void archive(archive_node& n) const override;
68         void read_archive(const archive_node& n, lst& syms) override;
69 protected:
70         ex derivative(const symbol & s) const override;
71         bool is_equal_same_type(const basic & other) const override;
72         bool match_same_type(const basic & other) const override;
73
74         // non-virtual functions in this class
75 public:
76         const paramset& derivatives() const;
77 protected:
78         void do_print(const print_context & c, unsigned level) const;
79         void do_print_latex(const print_context & c, unsigned level) const;
80         void do_print_csrc(const print_csrc & c, unsigned level) const;
81         void do_print_tree(const print_tree & c, unsigned level) const;
82
83         // member variables
84 protected:
85         paramset parameter_set; /**< Set of parameter numbers with respect to which to take the derivative */
86 };
87 GINAC_DECLARE_UNARCHIVER(fderivative); 
88
89 } // namespace GiNaC
90
91 #endif // ndef GINAC_DERIVATIVE_H