Reference documentation for deal.II version GIT 9042b9283b 2023-12-02 14:50:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
symengine_math.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2019 - 2023 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #include <deal.II/base/config.h>
18 
19 #ifdef DEAL_II_WITH_SYMENGINE
20 
22 
23 # include <symengine/add.h>
24 # include <symengine/functions.h>
25 # include <symengine/mul.h>
26 # include <symengine/pow.h>
27 
29 
30 namespace Differentiation
31 {
32  namespace SD
33  {
34  namespace SE = ::SymEngine;
35 
36  /* --------------------------- Math functions ------------------------- */
37 
38  Expression
39  pow(const Expression &base, const Expression &exponent)
40  {
41  return SE::pow(base.get_RCP(), exponent.get_RCP());
42  }
43 
44 
45  Expression
46  sqrt(const Expression &x)
47  {
48  return SE::sqrt(x.get_RCP());
49  }
50 
51 
52  Expression
53  cbrt(const Expression &x)
54  {
55  return SE::cbrt(x.get_RCP());
56  }
57 
58 
59  Expression
60  exp(const Expression &exponent)
61  {
62  return SE::exp(exponent.get_RCP());
63  }
64 
65 
66  Expression
67  log(const Expression &x)
68  {
69  return SE::log(x.get_RCP());
70  }
71 
72 
73  Expression
74  log(const Expression &x, const Expression &base)
75  {
76  return SE::log(x.get_RCP(), base.get_RCP());
77  }
78 
79 
80  Expression
81  log10(const Expression &x)
82  {
83  return log(x.get_RCP(), Expression(10.0));
84  }
85 
86 
87  Expression
88  sin(const Expression &x)
89  {
90  return SE::sin(x.get_RCP());
91  }
92 
93 
94  Expression
95  cos(const Expression &x)
96  {
97  return SE::cos(x.get_RCP());
98  }
99 
100 
101  Expression
102  tan(const Expression &x)
103  {
104  return SE::tan(x.get_RCP());
105  }
106 
107 
108  Expression
109  csc(const Expression &x)
110  {
111  return SE::csc(x.get_RCP());
112  }
113 
114 
115  Expression
116  sec(const Expression &x)
117  {
118  return SE::sec(x.get_RCP());
119  }
120 
121 
122  Expression
123  cot(const Expression &x)
124  {
125  return SE::cot(x.get_RCP());
126  }
127 
128 
129  Expression
130  asin(const Expression &x)
131  {
132  return SE::asin(x.get_RCP());
133  }
134 
135 
136  Expression
137  acos(const Expression &x)
138  {
139  return SE::acos(x.get_RCP());
140  }
141 
142 
143  Expression
144  atan(const Expression &x)
145  {
146  return SE::atan(x.get_RCP());
147  }
148 
149 
150  Expression
151  atan2(const Expression &y, const Expression &x)
152  {
153  return SE::atan2(y.get_RCP(), x.get_RCP());
154  }
155 
156 
157  Expression
158  acsc(const Expression &x)
159  {
160  return SE::acsc(x.get_RCP());
161  }
162 
163 
164  Expression
165  asec(const Expression &x)
166  {
167  return SE::asec(x.get_RCP());
168  }
169 
170 
171  Expression
172  acot(const Expression &x)
173  {
174  return SE::acot(x.get_RCP());
175  }
176 
177 
178  Expression
179  sinh(const Expression &x)
180  {
181  return SE::sinh(x.get_RCP());
182  }
183 
184 
185  Expression
186  cosh(const Expression &x)
187  {
188  return SE::cosh(x.get_RCP());
189  }
190 
191 
192  Expression
193  tanh(const Expression &x)
194  {
195  return SE::tanh(x.get_RCP());
196  }
197 
198 
199  Expression
200  csch(const Expression &x)
201  {
202  return SE::csch(x.get_RCP());
203  }
204 
205 
206  Expression
207  sech(const Expression &x)
208  {
209  return SE::sech(x.get_RCP());
210  }
211 
212 
213  Expression
214  coth(const Expression &x)
215  {
216  return SE::coth(x.get_RCP());
217  }
218 
219 
220  Expression
221  asinh(const Expression &x)
222  {
223  return SE::asinh(x.get_RCP());
224  }
225 
226 
227  Expression
228  acosh(const Expression &x)
229  {
230  return SE::acosh(x.get_RCP());
231  }
232 
233 
234  Expression
235  atanh(const Expression &x)
236  {
237  return SE::atanh(x.get_RCP());
238  }
239 
240 
241  Expression
242  acsch(const Expression &x)
243  {
244  return SE::acsch(x.get_RCP());
245  }
246 
247 
248  Expression
249  asech(const Expression &x)
250  {
251  return SE::asech(x.get_RCP());
252  }
253 
254 
255  Expression
256  acoth(const Expression &x)
257  {
258  return SE::acoth(x.get_RCP());
259  }
260 
261 
262  Expression
263  abs(const Expression &x)
264  {
265  return SE::abs(x.get_RCP());
266  }
267 
268 
269  Expression
270  fabs(const Expression &x)
271  {
272  return SE::abs(x.get_RCP());
273  }
274 
275 
276  Expression
277  sign(const Expression &x)
278  {
279  return SE::sign(x.get_RCP());
280  }
281 
282 
283  Expression
284  copysign(const Expression &value, const Expression &sign)
285  {
286  return value * Expression(SE::sign(sign.get_RCP()));
287  }
288 
289 
290  Expression
291  floor(const Expression &x)
292  {
293  return SE::floor(x.get_RCP());
294  }
295 
296 
297  Expression
298  ceil(const Expression &x)
299  {
300  return SE::ceiling(x.get_RCP());
301  }
302 
303 
304  Expression
305  max(const Expression &a, const Expression &b)
306  {
307  return SE::max({a.get_RCP(), b.get_RCP()});
308  }
309 
310 
311  Expression
312  min(const Expression &a, const Expression &b)
313  {
314  return SE::min({a.get_RCP(), b.get_RCP()});
315  }
316 
317 
318  Expression
319  erf(const Expression &x)
320  {
321  return SE::erf(x.get_RCP());
322  }
323 
324 
325  Expression
326  erfc(const Expression &x)
327  {
328  return SE::erfc(x.get_RCP());
329  }
330 
331  } // namespace SD
332 } // namespace Differentiation
333 
335 
336 #endif // DEAL_II_WITH_SYMENGINE
const SymEngine::RCP< const SymEngine::Basic > & get_RCP() const
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
Expression cbrt(const Expression &x)
Expression atanh(const Expression &x)
Expression atan2(const Expression &y, const Expression &x)
Expression asin(const Expression &x)
Expression asinh(const Expression &x)
Expression cosh(const Expression &x)
Expression csc(const Expression &x)
Expression acsch(const Expression &x)
Expression abs(const Expression &x)
Expression fabs(const Expression &x)
Expression ceil(const Expression &x)
Expression coth(const Expression &x)
Expression sinh(const Expression &x)
Expression sec(const Expression &x)
Expression atan(const Expression &x)
Expression floor(const Expression &x)
Expression tanh(const Expression &x)
Expression acsc(const Expression &x)
Expression sin(const Expression &x)
Expression max(const Expression &a, const Expression &b)
Expression erfc(const Expression &x)
Expression exp(const Expression &exponent)
Expression asech(const Expression &x)
Expression pow(const Expression &base, const Expression &exponent)
Expression sign(const Expression &x)
Expression sech(const Expression &x)
Expression acos(const Expression &x)
Expression csch(const Expression &x)
Expression tan(const Expression &x)
Expression acosh(const Expression &x)
Expression min(const Expression &a, const Expression &b)
Expression asec(const Expression &x)
Expression cot(const Expression &x)
Expression cos(const Expression &x)
Expression erf(const Expression &x)
Expression acoth(const Expression &x)
Expression acot(const Expression &x)
Expression log(const Expression &x)
Expression sqrt(const Expression &x)
Expression log10(const Expression &x)
Expression copysign(const Expression &value, const Expression &sign)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)