7 #ifndef IMPISD_VON_MISES_H
8 #define IMPISD_VON_MISES_H
10 #include <IMP/isd/isd_config.h>
15 #include <boost/math/special_functions/bessel.hpp>
17 IMPISD_BEGIN_NAMESPACE
31 vonMises(
double x,
double mu,
double kappa)
33 force_set_kappa(kappa);
37 virtual double evaluate()
const
39 return logterm_ - kappa_*cos(x_-mu_);
42 virtual double evaluate_derivative_x()
const
43 {
return kappa_*sin(x_-mu_); }
45 virtual double evaluate_derivative_mu()
const
46 {
return -kappa_*sin(x_-mu_); }
48 virtual double evaluate_derivative_kappa()
const
49 {
return -cos(x_-mu_) + I1_/I0_; }
52 virtual double density()
const
54 return exp(kappa_*cos(x_-mu_))/(2*
IMP::PI*I0_);
58 void set_x(
double x) {
61 void set_mu(
double mu) {
64 void set_kappa(
double kappa) {
65 if (kappa_ != kappa) {
66 force_set_kappa(kappa);
71 <<
", " << kappa_ <<std::endl, {});
74 void force_set_kappa(
double kappa) {
76 I0_ = boost::math::cyl_bessel_i(0, kappa);
77 I1_ = boost::math::cyl_bessel_i(1, kappa);
80 double x_,mu_,kappa_,I0_,I1_,logterm_;