I want to graph R vs. g for n=0,1 and 2.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to graph R vs g for g=[0, 0.5]
Y axis is restricted (0 to 0.25)
7 Kommentare
John D'Errico
am 3 Apr. 2023
As a hint, I would compute each term as the sum of the logs of each part of those elements. Only at the end do you exponentiate the result. If not, expect to rapidly see underflows or overflows, or maybe both at once.
As a second hint, how do you compute the log of a factorial? The simplest way is to use the relationship of the factorial to the gamma function, and to then realize that MATLAB provides the function gammaln, which computes the natural log of the gamma function.
Alternatively, you would find that Stirling's approximation is actually quite accurate for the factorial, and it is easily logged. Or, you could compute the log of a factorial as the sum of the logs of the integers in the necessary product. Even so, just use gammaln.
Finally, Torsten gave you a relation for the double factorial
In the end though, you need to put it together as this is your assignment, not ours. At the very least, you need to make a credible effort.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Debugging and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!