Dealing with numbers bigger than Realmax
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
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.
0 comentarios
Ver también
Categorías
Más información sobre Gamma Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!