Dealing with numbers bigger than Realmax

3 visualizaciones (últimos 30 días)
Raed Marabeh
Raed Marabeh el 20 de En. de 2021
Respondida: John D'Errico el 20 de En. de 2021
I have a code in Matlab, and in one step it calculates Gamma function for different values. But when I try to find Gamma(172.5) I get inf as it is greatter than realmax. My question: is there a away that I can get and calculate big numbera like Gamma (172.5) in Matlab without getting inf?
Thanks

Respuestas (1)

John D'Errico
John D'Errico el 20 de En. de 2021
No. Not using double precision numbers. That does not say you can do nothing.
You can use the symbolic toolbox to compute the result. This will be slow if you are doing many computations. But it will work.
Or you can learn about how to work with logs in your computations. Then you can learn about the function gammaln. This computes the natural log of the gamma function.
That does not mean you can then simply exponentiate the result, since it will still overflow. But if you learn about how to do these computations, you can almost always suceed.

Categorías

Más información sobre Gamma Functions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by