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