sigma  1.0.0
Loading...
Searching...
No Matches
exponents.ipp
1#pragma once
2#include <cmath>
6
7namespace sigma {
8
9template<typename T>
11 if(a.empty()) { return a; }
12 if(a.bound().lower() <= T(0.0)) {
13 throw std::domain_error("Taylor polynomial has non-positive values.");
14 }
15 return a.compose_(
17}
18
19template<typename T>
21 if(a.empty()) { return a; }
23}
24
25template<typename T>
27 if(a.empty()) { return a; }
28 if(a.bound().lower() <= T(0.0)) {
29 throw std::domain_error("Taylor polynomial has non-positive values.");
30 }
32}
33
34template<typename T, typename U>
35Taylor<T> pow(const Taylor<T>& a, const U& exp) {
36 auto order = a.max_order();
37 return detail::pow_impl(a, exp, [order](T v) {
38 return Taylor<T>(v, typename Taylor<T>::Order(order));
39 });
40}
41
42} // namespace sigma
value_t lower() const
Returns the lower bound of the interval.
Definition interval.hpp:116
Implements truncated multivariate polynomial algebra.
Definition taylor.hpp:46
bool empty() const noexcept
Checks if this Taylor polynomial represents the empty set.
Definition taylor.hpp:257
Taylor compose_(const std::vector< value_t > &outer_coeffs) const
Evaluates a truncated outer Taylor series about the constant term of *this.
Definition taylor.hpp:949
value_t constant() const
Returns the constant term of *this.
Definition taylor.hpp:223
interval_t bound() const
Returns an interval enclosing the values of the polynomial.
Definition taylor.hpp:819
size_type max_order() const noexcept
Returns the truncation order of *this.
Definition taylor.hpp:213
The primary namespace for the sigma library.
Definition affine.hpp:12
Affine< T > exp(const Affine< T > &a)
Calculate the exponential of an affine form.
Definition exponents.ipp:31
Affine< T > pow(const Affine< T > &a, const U &exp)
Calculate the power of an affine form.
Definition exponents.ipp:72
Affine< T > log(const Affine< T > &a)
Calculate the natural logarithm of an affine form.
Definition exponents.ipp:51
Affine< T > sqrt(const Affine< T > &a)
Calculate the square root of an affine form.
Definition exponents.ipp:9
Shared implementation of pow() for Affine, Taylor, and TaylorModel.
X pow_impl(const X &a, const U &power, MakePoint &&make_point)
Implements x^y, shared by Affine::pow, Taylor::pow, and TaylorModel::pow.
Definition pow.hpp:55
Shared helpers for building the outer Taylor series of the elementary functions (exp,...
std::vector< T > log_outer_coeffs(T c, std::size_t order)
Definition series_detail.hpp:72
std::vector< T > exp_outer_coeffs(T c, std::size_t order)
Definition series_detail.hpp:60
std::vector< T > sqrt_outer_coeffs(T c, std::size_t order)
Outer-series coefficients of sqrt(x) about c: sqrt(c) * C(1/2,k) / c^k.
Definition series_detail.hpp:99
Tag type used to pass the truncation order to constructors.
Definition taylor.hpp:77
Defines the Taylor class.