From 5ddde2f9bc7638dd815ed82423ad98e053154f54 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Sat, 30 Mar 2019 23:27:46 +0100 Subject: [PATCH] Add functions to perform symbolic math operations using SD::Expression --- .../changes/minor/20190330Jean-PaulPelteret | 4 + include/deal.II/differentiation/sd.h | 1 + .../differentiation/sd/symengine_math.h | 785 ++++++++++++++++++ source/differentiation/sd/CMakeLists.txt | 1 + source/differentiation/sd/symengine_math.cc | 339 ++++++++ 5 files changed, 1130 insertions(+) create mode 100644 doc/news/changes/minor/20190330Jean-PaulPelteret create mode 100644 include/deal.II/differentiation/sd/symengine_math.h create mode 100644 source/differentiation/sd/symengine_math.cc diff --git a/doc/news/changes/minor/20190330Jean-PaulPelteret b/doc/news/changes/minor/20190330Jean-PaulPelteret new file mode 100644 index 0000000000..22364ffafe --- /dev/null +++ b/doc/news/changes/minor/20190330Jean-PaulPelteret @@ -0,0 +1,4 @@ +New: The Differentiation::SD::Expression class can now be used to perform +symbolic math calculations. +
+(Jean-Paul Pelteret, 2019/03/30) diff --git a/include/deal.II/differentiation/sd.h b/include/deal.II/differentiation/sd.h index f2707cbfc6..0366a5fbd9 100644 --- a/include/deal.II/differentiation/sd.h +++ b/include/deal.II/differentiation/sd.h @@ -20,6 +20,7 @@ #ifdef DEAL_II_WITH_SYMENGINE +# include # include # include # include diff --git a/include/deal.II/differentiation/sd/symengine_math.h b/include/deal.II/differentiation/sd/symengine_math.h new file mode 100644 index 0000000000..9f18c603f9 --- /dev/null +++ b/include/deal.II/differentiation/sd/symengine_math.h @@ -0,0 +1,785 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2019 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef dealii_differentiation_sd_symengine_math_h +#define dealii_differentiation_sd_symengine_math_h + +#include + +#ifdef DEAL_II_WITH_SYMENGINE + +# include + +# include + +DEAL_II_NAMESPACE_OPEN + +namespace Differentiation +{ + namespace SD + { + namespace SE = ::SymEngine; + + /** + * @name Mathematical functions + * + * It is necessary that all computed inputs to SymEngine functions are + * of type SE::RCP. So we instead simply offer a unified + * interface to Expression types and with other permutations of numbers + * we convert between them. + * + * For a full list of functions that we (ultimately) expect to support, see + * http://www.cplusplus.com/reference/cmath/. Those that are currently + * supported are extracted from symengine/{functions,pow}.h; + * symengine/type_codes.inc. + */ + + /** + * @name Power functions + */ + //@{ + + /** + * Return a symbolic number that represents a @p base value to the power of + * an @p exponent. + * + * Mimics the function std::pow(base,exponent) using the + * standard math library. + */ + Expression + pow(const Expression &base, const Expression &exponent); + + /** + * Return a symbolic number that represents a @p base value to the power of + * an @p exponent. + * + * Mimics the function std::pow(base,exponent) using the + * standard math library. + * + * This variant is used when the @p exponent is not a Expression. + */ + template ::value>::type> + Expression + pow(const Expression &base, const NumberType &exponent) + { + // Call other implementation + return pow(base, Expression(exponent)); + } + + /** + * Return a symbolic number that represents a @p base value to the power of + * an @p exponent. + * + * Mimics the function std::pow(base,exponent) using the + * standard math library. + * + * This variant is used when the @p base is not a Expression. + */ + template ::value>::type> + Expression + pow(const NumberType &base, const Expression &exponent) + { + // Call other implementation + return pow(Expression(base), exponent); + } + + /** + * Return a symbolic number that represents the square root of some value @p x. + * + * Mimics the function std::sqrt(x) using the standard math + * library. + */ + Expression + sqrt(const Expression &x); + + /** + * Return a symbolic number that represents the cubic root of some value @p x. + * + * Mimics the function std::cbrt(x) using the standard math + * library. + */ + Expression + cbrt(const Expression &x); + + /** + * Return a symbolic number that represents the Euler constant + * $e approx 2.71828$ raised to the given @p exponent. + * + * Mimics the function std::exp(exponent) using the standard + * math library. + */ + Expression + exp(const Expression &exponent); + + /** + * Return a symbolic number that represents the natural logarithm of a value @p x. + * + * Mimics the function std::log(x) using the standard math + * library. + */ + Expression + log(const Expression &x); + + /** + * Return a symbolic number that represents the logarithm of a value @p x with + * respect to a @p base number. + * + * Mimics the function std::log(x,base) using the standard + * math library. + */ + Expression + log(const Expression &x, const Expression &base); + + /** + * Return a symbolic number that represents the logarithm of a value @p x with + * respect to a @p base number. + * + * Mimics the function std::log(x,base) using the standard + * math library. + * + * This variant is used when the @p base is not a Expression. + */ + template ::value>::type> + Expression + log(const Expression &x, const NumberType &base) + { + // Call other implementation + return log(x, Expression(base)); + } + + /** + * Return a symbolic number that represents the logarithm of a value @p x with + * respect to a @p base number. + * + * Mimics the function std::log(x,base) using the standard + * math library. + * + * This variant is used when the @p value is not a Expression. + */ + template ::value>::type> + Expression + log(const NumberType &x, const Expression &base) + { + // Call other implementation + return log(Expression(x), base); + } + + /** + * Return a symbolic number that represents the base 10 logarithm of a value @p x. + * + * Mimics the function std::log10(x) using the standard math + * library. + */ + Expression + log10(const Expression &x); + + //@} + + /** + * @name Trignometric functions + */ + //@{ + + /** + * Return a symbolic number that represents the sine function with the + * given argument @p x. + * + * Mimics the function std::sin(x) using the standard math + * library. + */ + Expression + sin(const Expression &x); + + /** + * Return a symbolic number that represents the cosine function with the + * given argument @p x. + * + * Mimics the function std::cos(x) using the standard math + * library. + */ + Expression + cos(const Expression &x); + + /** + * Return a symbolic number that represents the tangent function with the + * given argument @p x. + * + * Mimics the function std::tan(x) using the standard math + * library. + */ + Expression + tan(const Expression &x); + + /** + * Return a symbolic number that represents the cosecant function with the + * given argument @p x. + * + * Mimics the function 1.0/std::sin(x) using the standard + * math library. + */ + Expression + csc(const Expression &x); + + /** + * Return a symbolic number that represents the secant function with the + * given argument @p x. + * + * Mimics the function 1.0/std::cos(x) using the standard + * math library. + */ + Expression + sec(const Expression &x); + + /** + * Return a symbolic number that represents the cotangent function with the + * given argument @p x. + * + * Mimics the function 1.0/std::tan(x) using the standard + * math library. + */ + Expression + cot(const Expression &x); + + /** + * Return a symbolic number that represents the inverse sine function with + * the + * given argument @p x. + * + * Mimics the function std::asin(x) using the standard math + * library. + */ + Expression + asin(const Expression &x); + + /** + * Return a symbolic number that represents the inverse cosine function + * with the + * given argument @p x. + * + * Mimics the function std::acos(x) using the standard math + * library. + */ + Expression + acos(const Expression &x); + + /** + * Return a symbolic number that represents the inverse tangent function + * with the + * given argument @p x. + * + * Mimics the function std::atan(x) using the standard math + * library. + */ + Expression + atan(const Expression &x); + + /** + * Return a symbolic number that represents the inverse tangent function + * with the + * given arguments @p x and @p y. + * + * Mimics the function std::atan2(y,x) using the standard + * math library. + */ + Expression + atan2(const Expression &y, const Expression &x); + + /** + * Return a symbolic number that represents the inverse tangent function + * with the + * given arguments @p x and @p y. + * + * Mimics the function std::atan2(y,x) using the standard + * math library. + * + * This variant is used when the numerator @p y is not a Expression. + */ + template ::value>::type> + Expression + atan2(const NumberType &y, const Expression &x) + { + // Call other implementation + return atan2(Expression(y), x); + } + + /** + * Return a symbolic number that represents the inverse tangent function + * with the + * given arguments @p x and @p y. + * + * Mimics the function std::atan2(y,x) using the standard + * math library. + * + * This variant is used when the denominator @p x is not a Expression. + */ + template ::value>::type> + Expression + atan2(const Expression &y, const NumberType &x) + { + // Call other implementation + return atan2(y, Expression(x)); + } + + /** + * Return a symbolic number that represents the inverse cosecant function + * with the + * given argument @p x. + * + * Mimics the function 1.0/std::asin(x) using the standard + * math library. + */ + Expression + acsc(const Expression &x); + + /** + * Return a symbolic number that represents the inverse secant function + * with the + * given argument @p x. + * + * Mimics the function 1.0/std::acos(x) using the standard + * math library. + */ + Expression + asec(const Expression &x); + + /** + * Return a symbolic number that represents the inverse cotangent function + * with the + * given argument @p x. + * + * Mimics the function 1.0/std::atan(x) using the standard + * math library. + */ + Expression + acot(const Expression &x); + + //@} + + /** + * @name Hyperbolic trignometric functions + */ + //@{ + + /** + * Return a symbolic number that represents the hyperbolic sine function + * with the + * given argument @p x. + * + * Mimics the function std::sinh(x) using the standard math + * library. + */ + Expression + sinh(const Expression &x); + + /** + * Return a symbolic number that represents the hyperbolic cosine function + * with the + * given argument @p x. + * + * Mimics the function std::cosh(x) using the standard math + * library. + */ + Expression + cosh(const Expression &x); + + /** + * Return a symbolic number that represents the hyperbolic tangent function + * with the + * given argument @p x. + * + * Mimics the function std::tanh(x) using the standard math + * library. + */ + Expression + tanh(const Expression &x); + + /** + * Return a symbolic number that represents the hyperbolic cosecant + * function with the + * given argument @p x. + * + * Mimics the function 1.0/std::sinh(x) using the standard + * math library. + */ + Expression + csch(const Expression &x); + + /** + * Return a symbolic number that represents the hyperbolic secant function + * with the + * given argument @p x. + * + * Mimics the function 1.0/std::cosh(x) using the standard + * math library. + */ + Expression + sech(const Expression &x); + + /** + * Return a symbolic number that represents the hyperbolic cotangent + * function with the + * given argument @p x. + * + * Mimics the function 1.0/std::tanh(x) using the standard + * math library. + */ + Expression + coth(const Expression &x); + + /** + * Return a symbolic number that represents the inverse hyperbolic sine + * function with the + * given argument @p x. + * + * Mimics the function std::asinh(x) using the standard math + * library. + */ + Expression + asinh(const Expression &x); + + /** + * Return a symbolic number that represents the inverse hyperbolic cosine + * function with the + * given argument @p x. + * + * Mimics the function std::acosh(x) using the standard math + * library. + */ + Expression + acosh(const Expression &x); + + /** + * Return a symbolic number that represents the inverse hyperbolic tangent + * function with the + * given argument @p x. + * + * Mimics the function std::atanh(x) using the standard math + * library. + */ + Expression + atanh(const Expression &x); + + /** + * Return a symbolic number that represents the inverse hyperbolic cosecant + * function with the + * given argument @p x. + * + * Mimics the function 1.0/std::asin(x) using the standard + * math library. + */ + Expression + acsch(const Expression &x); + + /** + * Return a symbolic number that represents the inverse hyperbolic secant + * function with the + * given argument @p x. + * + * Mimics the function 1.0/std::acos(x) using the standard + * math library. + */ + Expression + asech(const Expression &x); + + /** + * Return a symbolic number that represents the inverse hyperbolic + * cotangent function with the + * given argument @p x. + * + * Mimics the function 1.0/std::atan(x) using the standard + * math library. + */ + Expression + acoth(const Expression &x); + + //@} + + /** + * @name Other functions + */ + //@{ + + /** + * Return a symbolic number that represents the absolute value of value @p x. + * + * Mimics the function std::abs(x) using the standard math + * library. + */ + Expression + abs(const Expression &x); + + + /** + * Return a symbolic number that represents the absolute value of value @p x. + * + * Mimics the function std::fabs(x) using the standard math + * library. + */ + Expression + fabs(const Expression &x); + + + /** + * Return a symbolic number that represents the sign of value @p x. + * + * Although there is no such function in the standard library, it mimics + * the function boost::sign(x) using the + * boost math library. + */ + Expression + sign(const Expression &x); + + + /** + * Return a symbolic number that represents the @p value of the first + * argument that takes the @p sign of the second argument. + * + * Mimics the function std::copysign(value, sign) using + * the standard math library. + */ + Expression + copysign(const Expression &value, const Expression &sign); + + + /** + * Return a symbolic number that represents the floor of value @p x. + * + * Mimics the function std::floor(x) using the standard math + * library. + */ + Expression + floor(const Expression &x); + + + /** + * Return a symbolic number that represents the ceiling of value @p x. + * + * Mimics the function std::ceil(x) using the standard math + * library. + */ + Expression + ceil(const Expression &x); + + /** + * Return a symbolic number that represents the maximum of two + * values @p a and @p b. + * + * Mimics the function std::max(a,b) using the standard math + * library. + */ + Expression + max(const Expression &a, const Expression &b); + + /** + * Return a symbolic number that represents the maximum of two + * values @p a and @p b. + * + * Mimics the function std::max(a,b) using the standard math + * library. + * + * This variant is used when @p b is not a Expression. + */ + template ::value>::type> + Expression + max(const Expression &a, const NumberType &b) + { + // Call other implementation + return max(a, Expression(b)); + } + + /** + * Return a symbolic number that represents the maximum of two + * values @p a and @p b. + * + * Mimics the function std::max(a,b) using the standard math + * library. + * + * This variant is used when @p a is not a Expression. + */ + template ::value>::type> + Expression + max(const NumberType &a, const Expression &b) + { + // Call other implementation + return max(Expression(a), b); + } + + /** + * Return a symbolic number that represents the minimum of two + * values @p a and @p b. + * + * Mimics the function std::min(a,b) using the standard math + * library. + */ + Expression + min(const Expression &a, const Expression &b); + + /** + * Return a symbolic number that represents the minimum of two + * values @p a and @p b. + * + * Mimics the function std::min(a,b) using the standard math + * library. + * + * This variant is used when @p b is not a Expression. + */ + template ::value>::type> + Expression + min(const Expression &a, const NumberType &b) + { + // Call other implementation + return min(a, Expression(b)); + } + + /** + * Return a symbolic number that represents the minimum of two + * values @p a and @p b. + * + * Mimics the function std::min(a,b) using the standard math + * library. + * + * This variant is used when @p a is not a Expression. + */ + template ::value>::type> + Expression + min(const NumberType &a, const Expression &b) + { + // Call other implementation + return min(Expression(a), b); + } + + /** + * Return a symbolic number that represents error function with the + * given argument @p x. + * + * Mimics the function std::erf(x) using the standard math + * library. + */ + Expression + erf(const Expression &x); + + /** + * Return a symbolic number that represents complimentary error function + * with the given argument @p x. + * + * Mimics the function std::erfc(x) using the standard math + * library. + */ + Expression + erfc(const Expression &x); + + //@} + + } // namespace SD +} // namespace Differentiation + +DEAL_II_NAMESPACE_CLOSE + + +# ifndef DOXYGEN + +// Import math operations into standard namespace. +// This gives us the ability to use them within the Tensor class. +namespace std +{ + /** + * Expose SymEngine wrapper math functions + */ + +# define DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(func) \ + using dealii::Differentiation::SD::func; + +# define DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION(func) \ + using dealii::Differentiation::SD::func; + + DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION(pow) + DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION(max) + DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION(min) + DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION(copysign) + + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(exp) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(log10) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(sqrt) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(cbrt) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(erf) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(erfc) + // Note: Both unary and binary versions + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(log) + + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(abs) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(fabs) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(sign) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(floor) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(ceil) + + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(sin) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(cos) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(tan) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(csc) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(sec) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(cot) + + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(asin) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(acos) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(atan) + DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION(atan2) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(acsc) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(asec) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(acot) + + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(sinh) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(cosh) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(tanh) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(csch) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(sech) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(coth) + + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(asinh) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(acosh) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(atanh) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(acsch) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(asech) + DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION(acoth) + +# undef DEAL_II_EXPOSE_SYMENGINE_BINARY_MATH_FUNCTION +# undef DEAL_II_EXPOSE_SYMENGINE_UNARY_MATH_FUNCTION + +} // namespace std + +# endif // DOXYGEN + +#endif // DEAL_II_WITH_SYMENGINE + +#endif diff --git a/source/differentiation/sd/CMakeLists.txt b/source/differentiation/sd/CMakeLists.txt index f6730585d8..26920f47a9 100644 --- a/source/differentiation/sd/CMakeLists.txt +++ b/source/differentiation/sd/CMakeLists.txt @@ -16,6 +16,7 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) SET(_src + symengine_math.cc symengine_number_types.cc symengine_types.cc symengine_utilities.cc diff --git a/source/differentiation/sd/symengine_math.cc b/source/differentiation/sd/symengine_math.cc new file mode 100644 index 0000000000..0ea483a405 --- /dev/null +++ b/source/differentiation/sd/symengine_math.cc @@ -0,0 +1,339 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2019 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +#ifdef DEAL_II_WITH_SYMENGINE + +DEAL_II_DISABLE_EXTRA_DIAGNOSTICS +// Number operations +# include +# include +# include +# include +DEAL_II_ENABLE_EXTRA_DIAGNOSTICS + +# include + +DEAL_II_NAMESPACE_OPEN + +namespace Differentiation +{ + namespace SD + { + namespace SE = ::SymEngine; + + /* --------------------------- Math functions ------------------------- */ + + Expression + pow(const Expression &base, const Expression &exponent) + { + return SE::pow(base.get_RCP(), exponent.get_RCP()); + } + + + Expression + sqrt(const Expression &x) + { + return SE::sqrt(x.get_RCP()); + } + + + Expression + cbrt(const Expression &x) + { + return SE::cbrt(x.get_RCP()); + } + + + Expression + exp(const Expression &exponent) + { + return SE::exp(exponent.get_RCP()); + } + + + Expression + log(const Expression &x) + { + return SE::log(x.get_RCP()); + } + + + Expression + log(const Expression &x, const Expression &base) + { + return SE::log(x.get_RCP(), base.get_RCP()); + } + + + Expression + log10(const Expression &x) + { + return log(x.get_RCP(), Expression(10.0)); + } + + + Expression + sin(const Expression &x) + { + return SE::sin(x.get_RCP()); + } + + + Expression + cos(const Expression &x) + { + return SE::cos(x.get_RCP()); + } + + + Expression + tan(const Expression &x) + { + return SE::tan(x.get_RCP()); + } + + + Expression + csc(const Expression &x) + { + return SE::csc(x.get_RCP()); + } + + + Expression + sec(const Expression &x) + { + return SE::sec(x.get_RCP()); + } + + + Expression + cot(const Expression &x) + { + return SE::cot(x.get_RCP()); + } + + + Expression + asin(const Expression &x) + { + return SE::asin(x.get_RCP()); + } + + + Expression + acos(const Expression &x) + { + return SE::acos(x.get_RCP()); + } + + + Expression + atan(const Expression &x) + { + return SE::atan(x.get_RCP()); + } + + + Expression + atan2(const Expression &y, const Expression &x) + { + return SE::atan2(y.get_RCP(), x.get_RCP()); + } + + + Expression + acsc(const Expression &x) + { + return SE::acsc(x.get_RCP()); + } + + + Expression + asec(const Expression &x) + { + return SE::asec(x.get_RCP()); + } + + + Expression + acot(const Expression &x) + { + return SE::acot(x.get_RCP()); + } + + + Expression + sinh(const Expression &x) + { + return SE::sinh(x.get_RCP()); + } + + + Expression + cosh(const Expression &x) + { + return SE::cosh(x.get_RCP()); + } + + + Expression + tanh(const Expression &x) + { + return SE::tanh(x.get_RCP()); + } + + + Expression + csch(const Expression &x) + { + return SE::csch(x.get_RCP()); + } + + + Expression + sech(const Expression &x) + { + return SE::sech(x.get_RCP()); + } + + + Expression + coth(const Expression &x) + { + return SE::coth(x.get_RCP()); + } + + + Expression + asinh(const Expression &x) + { + return SE::asinh(x.get_RCP()); + } + + + Expression + acosh(const Expression &x) + { + return SE::acosh(x.get_RCP()); + } + + + Expression + atanh(const Expression &x) + { + return SE::atanh(x.get_RCP()); + } + + + Expression + acsch(const Expression &x) + { + return SE::acsch(x.get_RCP()); + } + + + Expression + asech(const Expression &x) + { + return SE::asech(x.get_RCP()); + } + + + Expression + acoth(const Expression &x) + { + return SE::acoth(x.get_RCP()); + } + + + Expression + abs(const Expression &x) + { + return SE::abs(x.get_RCP()); + } + + + Expression + fabs(const Expression &x) + { + return SE::abs(x.get_RCP()); + } + + + Expression + sign(const Expression &x) + { + return SE::sign(x.get_RCP()); + } + + + Expression + copysign(const Expression &value, const Expression &sign) + { + return value * Expression(SE::sign(sign.get_RCP())); + } + + + Expression + floor(const Expression &x) + { + return SE::floor(x.get_RCP()); + } + + + Expression + ceil(const Expression &x) + { + return SE::ceiling(x.get_RCP()); + } + + + Expression + max(const Expression &a, const Expression &b) + { + return SE::max({a.get_RCP(), b.get_RCP()}); + } + + + Expression + min(const Expression &a, const Expression &b) + { + return SE::min({a.get_RCP(), b.get_RCP()}); + } + + + Expression + erf(const Expression &x) + { + return SE::erf(x.get_RCP()); + } + + + Expression + erfc(const Expression &x) + { + return SE::erfc(x.get_RCP()); + } + + } // namespace SD +} // namespace Differentiation + +DEAL_II_NAMESPACE_CLOSE + +#endif // DEAL_II_WITH_SYMENGINE -- 2.39.5