1#include <symengine/printers/sbml.h>
2#include <symengine/printers.h>
10 names[SYMENGINE_LOG] =
"ln";
11 names[SYMENGINE_ASIN] =
"arcsin";
12 names[SYMENGINE_ACOS] =
"arccos";
13 names[SYMENGINE_ASEC] =
"arcsec";
14 names[SYMENGINE_ACSC] =
"arccsc";
15 names[SYMENGINE_ATAN] =
"arctan";
16 names[SYMENGINE_ACOT] =
"arccot";
17 names[SYMENGINE_ASINH] =
"arcsinh";
18 names[SYMENGINE_ACSCH] =
"arccsch";
19 names[SYMENGINE_ACOSH] =
"arccosh";
20 names[SYMENGINE_ATANH] =
"arctanh";
21 names[SYMENGINE_ACOTH] =
"arccoth";
22 names[SYMENGINE_ASECH] =
"arcsech";
27 const RCP<const Basic> &b)
30 o <<
"exp(" << apply(b) <<
")";
32 o <<
"sqrt(" << apply(a) <<
")";
34 o << parenthesizeLE(a, PrecedenceEnum::Pow);
36 o << parenthesizeLE(b, PrecedenceEnum::Pow);
40void SbmlPrinter::bvisit(
const BooleanAtom &x)
49void SbmlPrinter::bvisit(
const And &x)
52 const auto &container = x.get_container();
54 s << apply(*container.begin());
55 for (
auto it = ++(container.begin()); it != container.end(); ++it) {
56 s <<
", " << apply(*it);
62void SbmlPrinter::bvisit(
const Or &x)
65 const auto &container = x.get_container();
67 s << apply(*container.begin());
68 for (
auto it = ++(container.begin()); it != container.end(); ++it) {
69 s <<
", " << apply(*it);
75void SbmlPrinter::bvisit(
const Xor &x)
78 const auto &container = x.get_container();
80 s << apply(*container.begin());
81 for (
auto it = ++(container.begin()); it != container.end(); ++it) {
82 s <<
", " << apply(*it);
88void SbmlPrinter::bvisit(
const Not &x)
91 s <<
"not(" << *x.get_arg() <<
")";
95void SbmlPrinter::bvisit(
const Piecewise &x)
98 auto vec = x.get_vec();
99 auto it = vec.begin();
101 while (it != vec.end()) {
102 s << apply((*it).first);
104 s << apply((*it).second);
106 if (it != vec.end()) {
114void SbmlPrinter::bvisit(
const Infty &x)
119void SbmlPrinter::bvisit(
const Constant &x)
122 str_ =
"exponentiale";
129void SbmlPrinter::bvisit(
const Function &x)
133 vec_basic vec = x.get_args();
134 if (x.get_type_code() == SYMENGINE_GAMMA) {
136 o <<
"factorial(" << apply(vec) <<
" - 1)";
137 }
else if (x.get_type_code() == SYMENGINE_LOG && vec.size() == 2) {
139 o <<
"log(" << apply(vec[1]) <<
", " << apply(vec[0]) <<
")";
141 o << names_[x.get_type_code()];
142 o << parenthesize(apply(vec));
Main namespace for SymEngine package.
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
RCP< const Number > rational(long n, long d)
convenience creator from two longs