# MethodError: no method matching binomial

**URL:** <https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874>\
**Category:** General Usage\
**Tags:** matlab\
**Created:** [March 14, 2019, 4:16pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874 "2019-03-14T16:16:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aquaman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquaman/32/6586_2.png) [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Post date:** [March 14, 2019, 4:16pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874/1 "2019-03-14T16:16:04Z")

</div>

Dear all,

How can I fix MethodError: no method matching binomial:

> pr = 5.6783  
> for i = 1:round(pr/2)  
> n = 1/binomial(pr,i)  
> end

Best

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 14, 2019, 4:51pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874/2 "2019-03-14T16:51:50Z")

</div>

First, please [quote your code](https://discourse.julialang.org/t/psa-how-to-quote-code-with-backticks/7530).

Second, it is unclear what you are expecting from `binomial` when called with a `Float64` and an `Int`; as `Base.binomial` is for calculating n \choose k. Perhaps you are interested in

> **[GitHub - JuliaStats/Distributions.jl: A Julia package for probability...](https://github.com/JuliaStats/Distributions.jl)**
>
> A Julia package for probability distributions and associated functions. - GitHub - JuliaStats/Distributions.jl: A Julia package for probability distributions and associated functions.

---

<div class="post-metadata">

**Author:** ![Aquaman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aquaman/32/6586_2.png) [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Post date:** [March 14, 2019, 5:04pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874/3 "2019-03-14T17:04:02Z")

</div>

Thank you in advance!  
why do we need to install a third part package in PC, quit complex for such very simple problem ?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 14, 2019, 5:13pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874/4 "2019-03-14T17:13:10Z")

</div>

Because there are almost infinitely many problems that people consider simple, and they can’t all be covered in `Base` and the standard libraries.

Also, you are mistaken: installing packages is not complex, it is a very simple operation.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 14, 2019, 5:25pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-binomial/21874/5 "2019-03-14T17:25:32Z")

</div>

> [@Tamas\_Papp](#):
>
> Second, it is unclear what you are expecting from `binomial` when called with a `Float64` and an `Int` ; as `Base.binomial` is for calculating n \choose k.

I don’t know if that’s what’s expected here, but the usual generalization of binomial coefficients to non-integer upper index is

{r \choose k} = \frac{r(r-1) \ldots (r-k+1)}{k!}.
