Skip to content

Commit

Permalink
Updated rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
adolfomunoz committed Jun 5, 2024
1 parent 7806ea3 commit 6d9d2f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/newton-cotes/rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ struct Simpson {
template<typename Float, typename T,typename Norm = NormDefault>
constexpr Float pdf(Float t, const std::array<T,samples>& p, Float a, Float b, const Norm& norm = Norm()) const {
Float num = norm(at(t,p));
return (num<1.e-10)?Float(0):(num/pdf_integral_subrange(a,b,p,norm));
Float den = pdf_integral_subrange(a,b,p,norm);
if (den<1.e-10) return 1.0/(b-a);
else return num/den;
}

//My functions are below this line
Expand Down

0 comments on commit 6d9d2f5

Please sign in to comment.