Reference documentation for deal.II version 9.4.0
\(\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 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// Number operations
23# include <symengine/add.h>
24# include <symengine/functions.h>
25# include <symengine/mul.h>
26# include <symengine/pow.h>
28
30
32
33namespace Differentiation
34{
35 namespace SD
36 {
37 namespace SE = ::SymEngine;
38
39 /* --------------------------- Math functions ------------------------- */
40
41 Expression
42 pow(const Expression &base, const Expression &exponent)
43 {
44 return SE::pow(base.get_RCP(), exponent.get_RCP());
45 }
46
47
48 Expression
49 sqrt(const Expression &x)
50 {
51 return SE::sqrt(x.get_RCP());
52 }
53
54
55 Expression
56 cbrt(const Expression &x)
57 {
58 return SE::cbrt(x.get_RCP());
59 }
60
61
62 Expression
63 exp(const Expression &exponent)
64 {
65 return SE::exp(exponent.get_RCP());
66 }
67
68
69 Expression
70 log(const Expression &x)
71 {
72 return SE::log(x.get_RCP());
73 }
74
75
76 Expression
77 log(const Expression &x, const Expression &base)
78 {
79 return SE::log(x.get_RCP(), base.get_RCP());
80 }
81
82
83 Expression
84 log10(const Expression &x)
85 {
86 return log(x.get_RCP(), Expression(10.0));
87 }
88
89
90 Expression
91 sin(const Expression &x)
92 {
93 return SE::sin(x.get_RCP());
94 }
95
96
97 Expression
98 cos(const Expression &x)
99 {
100 return SE::cos(x.get_RCP());
101 }
102
103
104 Expression
105 tan(const Expression &x)
106 {
107 return SE::tan(x.get_RCP());
108 }
109
110
111 Expression
112 csc(const Expression &x)
113 {
114 return SE::csc(x.get_RCP());
115 }
116
117
118 Expression
119 sec(const Expression &x)
120 {
121 return SE::sec(x.get_RCP());
122 }
123
124
125 Expression
126 cot(const Expression &x)
127 {
128 return SE::cot(x.get_RCP());
129 }
130
131
132 Expression
133 asin(const Expression &x)
134 {
135 return SE::asin(x.get_RCP());
136 }
137
138
139 Expression
140 acos(const Expression &x)
141 {
142 return SE::acos(x.get_RCP());
143 }
144
145
146 Expression
147 atan(const Expression &x)
148 {
149 return SE::atan(x.get_RCP());
150 }
151
152
153 Expression
154 atan2(const Expression &y, const Expression &x)
155 {
156 return SE::atan2(y.get_RCP(), x.get_RCP());
157 }
158
159
160 Expression
161 acsc(const Expression &x)
162 {
163 return SE::acsc(x.get_RCP());
164 }
165
166
167 Expression
168 asec(const Expression &x)
169 {
170 return SE::asec(x.get_RCP());
171 }
172
173
174 Expression
175 acot(const Expression &x)
176 {
177 return SE::acot(x.get_RCP());
178 }
179
180
181 Expression
182 sinh(const Expression &x)
183 {
184 return SE::sinh(x.get_RCP());
185 }
186
187
188 Expression
189 cosh(const Expression &x)
190 {
191 return SE::cosh(x.get_RCP());
192 }
193
194
195 Expression
196 tanh(const Expression &x)
197 {
198 return SE::tanh(x.get_RCP());
199 }
200
201
202 Expression
203 csch(const Expression &x)
204 {
205 return SE::csch(x.get_RCP());
206 }
207
208
209 Expression
210 sech(const Expression &x)
211 {
212 return SE::sech(x.get_RCP());
213 }
214
215
216 Expression
217 coth(const Expression &x)
218 {
219 return SE::coth(x.get_RCP());
220 }
221
222
223 Expression
225 {
226 return SE::asinh(x.get_RCP());
227 }
228
229
230 Expression
232 {
233 return SE::acosh(x.get_RCP());
234 }
235
236
237 Expression
239 {
240 return SE::atanh(x.get_RCP());
241 }
242
243
244 Expression
246 {
247 return SE::acsch(x.get_RCP());
248 }
249
250
251 Expression
253 {
254 return SE::asech(x.get_RCP());
255 }
256
257
258 Expression
260 {
261 return SE::acoth(x.get_RCP());
262 }
263
264
265 Expression
266 abs(const Expression &x)
267 {
268 return SE::abs(x.get_RCP());
269 }
270
271
272 Expression
273 fabs(const Expression &x)
274 {
275 return SE::abs(x.get_RCP());
276 }
277
278
279 Expression
280 sign(const Expression &x)
281 {
282 return SE::sign(x.get_RCP());
283 }
284
285
286 Expression
287 copysign(const Expression &value, const Expression &sign)
288 {
289 return value * Expression(SE::sign(sign.get_RCP()));
290 }
291
292
293 Expression
295 {
296 return SE::floor(x.get_RCP());
297 }
298
299
300 Expression
301 ceil(const Expression &x)
302 {
303 return SE::ceiling(x.get_RCP());
304 }
305
306
307 Expression
308 max(const Expression &a, const Expression &b)
309 {
310 return SE::max({a.get_RCP(), b.get_RCP()});
311 }
312
313
314 Expression
315 min(const Expression &a, const Expression &b)
316 {
317 return SE::min({a.get_RCP(), b.get_RCP()});
318 }
319
320
321 Expression
322 erf(const Expression &x)
323 {
324 return SE::erf(x.get_RCP());
325 }
326
327
328 Expression
329 erfc(const Expression &x)
330 {
331 return SE::erfc(x.get_RCP());
332 }
333
334 } // namespace SD
335} // namespace Differentiation
336
338
339#endif // DEAL_II_WITH_SYMENGINE
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
Definition: config.h:456
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
#define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS
Definition: config.h:495
const SymEngine::RCP< const SymEngine::Basic > & get_RCP() const
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)
::VectorizedArray< Number, width > log(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > exp(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > tan(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > cos(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)