How to simplify factorial before calculating the result

1 vue (au cours des 30 derniers jours)
Christophe Croisetière
Christophe Croisetière le 29 Sep 2021
Modifié(e) : James Tursa le 29 Sep 2021
Hi, I'm trying to calculate (2189!/(2165!*24!))/(2190!/(2165!*25!)). MathLab is telling me it's NaN because of the Inf/Inf result but i know the answer is around 1/438. Is there a way to tell MathLab to simplify the factorials before calulating their values.
  1 commentaire
James Tursa
James Tursa le 29 Sep 2021
Modifié(e) : James Tursa le 29 Sep 2021
Is it only this particular calculation you are interested in (which easily reduces to 25/2190 by inspection ... not close to your claimed 1/438), or is this simply an example of a more generic calculation?

Connectez-vous pour commenter.

Réponses (1)

Matt J
Matt J le 29 Sep 2021
nchoosek(2189,24)/nchoosek(2190,25),
Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits
Warning: Result may not be exact. Coefficient is greater than 9.007199e+15 and is only accurate to 15 digits
ans = 0.0114
  2 commentaires
Christophe Croisetière
Christophe Croisetière le 29 Sep 2021
You're my savior.
Matt J
Matt J le 29 Sep 2021
I'm glad, but if so, please Accept-click the answer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by