17#ifndef THEORETICA_DUAL_FUNCTIONS_H
18#define THEORETICA_DUAL_FUNCTIONS_H
48 const real pow_n_1_x =
pow(x.
Re(), n - 1);
49 return dual(pow_n_1_x * x.
Re(), pow_n_1_x * n * x.
Dual());
63 return dual(sqrt_x, 0.5 / sqrt_x * x.
Dual());
111 return dual(exp_x, x.
Dual() * exp_x);
198 (exp_x - 1.0 / exp_x) / 2.0,
199 x.
Dual() * (exp_x + 1.0 / exp_x) / 2.0
209 (exp_x + 1.0 / exp_x) / 2.0,
210 x.
Dual() * (exp_x - 1.0 / exp_x) / 2.0
222 t = (1.0 - exp_2x) / (1.0 + exp_2x);
224 t = (exp_2x - 1.0) / (1.0 + exp_2x);
226 const real dt = (4.0 * exp_2x) /
square(1.0 + exp_2x);
Dual number class.
Definition dual.h:28
dual conjugate() const
Get the dual conjugate.
Definition dual.h:117
const real & Dual() const
Return dual part.
Definition dual.h:96
const real & Re() const
Return real part.
Definition dual.h:75
#define TH_MATH_ERROR(F_NAME, VALUE, EXCEPTION)
TH_MATH_ERROR is a macro which throws exceptions or modifies errno (depending on which compilation op...
Definition error.h:219
Main namespace of the library which contains all functions and objects.
Definition algebra.h:27
dual2 sqrt(dual2 x)
Compute the square root of a second order dual number.
Definition dual2_functions.h:54
dual2 ln(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:195
dual2 abs(dual2 x)
Compute the absolute value of a second order dual number.
Definition dual2_functions.h:242
dual2 log2(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:210
dual2 asin(dual2 x)
Compute the arcsine of a second order dual number.
Definition dual2_functions.h:248
double real
A real number, defined as a floating point type.
Definition constants.h:207
dual2 exp(dual2 x)
Compute the exponential of a second order dual number.
Definition dual2_functions.h:138
dual2 log10(dual2 x)
Compute the natural logarithm of a second order dual number.
Definition dual2_functions.h:226
dual2 conjugate(dual2 x)
Return the conjugate of a second order dual number.
Definition dual2_functions.h:35
constexpr real LOG10E
The base-10 logarithm of e.
Definition constants.h:255
constexpr real LOG2E
The binary logarithm of e.
Definition constants.h:249
dual2 tanh(dual2 x)
Compute the hyperbolic tangent of a second order dual number.
Definition dual2_functions.h:179
TH_CONSTEXPR real nan()
Return a quiet NaN number in floating point representation.
Definition error.h:74
dual2 sinh(dual2 x)
Compute the hyperbolic sine of a second order dual number.
Definition dual2_functions.h:151
dual2 cos(dual2 x)
Compute the cosine of a second order dual number.
Definition dual2_functions.h:86
dual2 cot(dual2 x)
Compute the cotangent of a second order dual number.
Definition dual2_functions.h:119
@ OutOfDomain
Argument out of domain.
Definition error.h:28
@ DivByZero
Division by zero.
Definition error.h:27
dual2 tan(dual2 x)
Compute the tangent of a second order dual number.
Definition dual2_functions.h:100
dual2 cosh(dual2 x)
Compute the hyperbolic cosine of a second order dual number.
Definition dual2_functions.h:165
dual2 acos(dual2 x)
Compute the arcosine of a second order dual number.
Definition dual2_functions.h:267
int sgn(real x)
Return the sign of x (1 if positive, -1 if negative, 0 if null).
Definition real_analysis.h:259
dual2 sin(dual2 x)
Compute the sine of a second order dual number.
Definition dual2_functions.h:72
dual2 square(dual2 x)
Return the square of a second order dual number.
Definition dual2_functions.h:23
dual2 atan(dual2 x)
Compute the arctangent of a second order dual number.
Definition dual2_functions.h:286
dual2 pow(dual2 x, int n)
Compute the n-th power of a second order dual number.
Definition dual2_functions.h:41
dual2 cube(dual2 x)
Return the cube of a second order dual number.
Definition dual2_functions.h:29