1 #ifndef PhysicsTools_Utilities_Derivative_h
2 #define PhysicsTools_Utilities_Derivative_h
6 #include <boost/type_traits.hpp>
12 template<
typename X,
typename A>
23 public ::boost::is_same<
DERIV(
X,
A),
NUM(0)> { };
33 (num<1>() / _._) * derivative<X>(_._));
37 sgn(_._) * derivative<X>(_._));
41 cos(_._) * derivative<X>(_._));
45 - (
sin(_._) * derivative<X>(_._)));
50 (num<1>() /
sqr(
cos(_._))) * derivative<X>(_._));
54 derivative<X>(_._1) + derivative<X>(_._2));
58 - derivative<X>(_._));
63 derivative<X>(_._1) * _._2 + _._1 * derivative<X>(_._2));
70 (derivative<X>(_._1) * _._2 -
71 _._1 * derivative<X>(_._2)) /
sqr(_._2));
76 _._2 *
pow(_._1, num<n - 1>()) * derivative<X>(_._1));
82 _._2 *
pow(_._1, fract<n - m, m>()) * derivative<X>(_._1));
88 (fract<1, 2>() * (num<1>() /
sqrt(_._))) *
const Numerical< n > & num()
#define DERIV_RULE(TMPL, T, RES, COMB)
typedef POWER(A, NUM(n)) arg
Derivative< X, A >::type derivative(const A &_)
Sin< T >::type sin(const T &t)
static type get(const A &_)
Sqrt< T >::type sqrt(const T &t)
Cos< T >::type cos(const T &t)
Sgn< T >::type sgn(const T &t)
TEMPL(T1) struct Divides0
typedef PROD(F, SUM(RATIO(A, F), RATIO(B, F))) type
Square< F >::type sqr(const F &f)
typedef DIFF(PROD(A, B1), PRIMIT(X, PROD(A1, B1))) type
Power< A, B >::type pow(const A &a, const B &b)