1 #ifndef STAN_MATH_FWD_SCAL_FUN_BESSEL_SECOND_KIND_HPP
2 #define STAN_MATH_FWD_SCAL_FUN_BESSEL_SECOND_KIND_HPP
3 
4 #include <stan/math/fwd/core.hpp>
5 #include <stan/math/prim/scal/fun/bessel_second_kind.hpp>
6 
7 namespace stan {
8 namespace math {
9 
10 template <typename T>
bessel_second_kind(int v,const fvar<T> & z)11 inline fvar<T> bessel_second_kind(int v, const fvar<T>& z) {
12   T bessel_second_kind_z(bessel_second_kind(v, z.val_));
13   return fvar<T>(bessel_second_kind_z,
14                  v * z.d_ * bessel_second_kind_z / z.val_
15                      - z.d_ * bessel_second_kind(v + 1, z.val_));
16 }
17 }  // namespace math
18 }  // namespace stan
19 #endif
20