Is Ramanujan's approximation for the factorial optimal, or can it be tweaked? (answer below)
Clash Royale CLAN TAG#URR8PPP
up vote
9
down vote
favorite
Ramanujan's famous factorial approximation, $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ is far more accurate that the Stirling approximation when applied to numbers less than 1, but it's not quite there. What could be done to tweak it without adding to its complexity?
Update: After experimenting with Ramanujan's approximation, I've discovered this disturbing fact: apparently, the error decreases slower than the factorial increases, leading to massive integer-level errors the higher the factorial gets. Allow me to demonstrate: $$beginarrayr
n&textactual n!&textRamanujan\hline
0&1&1.005513858315898906334685\
1&1&1.000283346113497298280502\
2&2&2.000066137639113675155990\
3&6&6.000048293969899370824935\
4&24&24.000067662060676644042510\
5&120&120.000147065856635128019467\
6&720&720.000442402580258517644894\
7&5040&5040.001717876125295382828871\
8&40320&40320.008220460028928349902077\
9&362880&362880.046912269278701001557543\
10&3628800&3628800.311612606631103904381528\
11&39916800&39916802.364768173672637433190699endarray$$ At first the error reduction is apparent, but then the zeroes start to disappear, until at $11!$ the error overtakes the decimal point. Now I'm not saying the error is increasingâonly that it it not decreasing fast enough. What can be done to correct this problem without radically altering the formula? I know that Ramanujan himself anticipated this problem when he wrote this inequality: $$sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1100<n!<sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ Could this hold the key? (See Formula 2.1 here)
factorial approximation-theory
add a comment |Â
up vote
9
down vote
favorite
Ramanujan's famous factorial approximation, $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ is far more accurate that the Stirling approximation when applied to numbers less than 1, but it's not quite there. What could be done to tweak it without adding to its complexity?
Update: After experimenting with Ramanujan's approximation, I've discovered this disturbing fact: apparently, the error decreases slower than the factorial increases, leading to massive integer-level errors the higher the factorial gets. Allow me to demonstrate: $$beginarrayr
n&textactual n!&textRamanujan\hline
0&1&1.005513858315898906334685\
1&1&1.000283346113497298280502\
2&2&2.000066137639113675155990\
3&6&6.000048293969899370824935\
4&24&24.000067662060676644042510\
5&120&120.000147065856635128019467\
6&720&720.000442402580258517644894\
7&5040&5040.001717876125295382828871\
8&40320&40320.008220460028928349902077\
9&362880&362880.046912269278701001557543\
10&3628800&3628800.311612606631103904381528\
11&39916800&39916802.364768173672637433190699endarray$$ At first the error reduction is apparent, but then the zeroes start to disappear, until at $11!$ the error overtakes the decimal point. Now I'm not saying the error is increasingâonly that it it not decreasing fast enough. What can be done to correct this problem without radically altering the formula? I know that Ramanujan himself anticipated this problem when he wrote this inequality: $$sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1100<n!<sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ Could this hold the key? (See Formula 2.1 here)
factorial approximation-theory
add a comment |Â
up vote
9
down vote
favorite
up vote
9
down vote
favorite
Ramanujan's famous factorial approximation, $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ is far more accurate that the Stirling approximation when applied to numbers less than 1, but it's not quite there. What could be done to tweak it without adding to its complexity?
Update: After experimenting with Ramanujan's approximation, I've discovered this disturbing fact: apparently, the error decreases slower than the factorial increases, leading to massive integer-level errors the higher the factorial gets. Allow me to demonstrate: $$beginarrayr
n&textactual n!&textRamanujan\hline
0&1&1.005513858315898906334685\
1&1&1.000283346113497298280502\
2&2&2.000066137639113675155990\
3&6&6.000048293969899370824935\
4&24&24.000067662060676644042510\
5&120&120.000147065856635128019467\
6&720&720.000442402580258517644894\
7&5040&5040.001717876125295382828871\
8&40320&40320.008220460028928349902077\
9&362880&362880.046912269278701001557543\
10&3628800&3628800.311612606631103904381528\
11&39916800&39916802.364768173672637433190699endarray$$ At first the error reduction is apparent, but then the zeroes start to disappear, until at $11!$ the error overtakes the decimal point. Now I'm not saying the error is increasingâonly that it it not decreasing fast enough. What can be done to correct this problem without radically altering the formula? I know that Ramanujan himself anticipated this problem when he wrote this inequality: $$sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1100<n!<sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ Could this hold the key? (See Formula 2.1 here)
factorial approximation-theory
Ramanujan's famous factorial approximation, $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ is far more accurate that the Stirling approximation when applied to numbers less than 1, but it's not quite there. What could be done to tweak it without adding to its complexity?
Update: After experimenting with Ramanujan's approximation, I've discovered this disturbing fact: apparently, the error decreases slower than the factorial increases, leading to massive integer-level errors the higher the factorial gets. Allow me to demonstrate: $$beginarrayr
n&textactual n!&textRamanujan\hline
0&1&1.005513858315898906334685\
1&1&1.000283346113497298280502\
2&2&2.000066137639113675155990\
3&6&6.000048293969899370824935\
4&24&24.000067662060676644042510\
5&120&120.000147065856635128019467\
6&720&720.000442402580258517644894\
7&5040&5040.001717876125295382828871\
8&40320&40320.008220460028928349902077\
9&362880&362880.046912269278701001557543\
10&3628800&3628800.311612606631103904381528\
11&39916800&39916802.364768173672637433190699endarray$$ At first the error reduction is apparent, but then the zeroes start to disappear, until at $11!$ the error overtakes the decimal point. Now I'm not saying the error is increasingâonly that it it not decreasing fast enough. What can be done to correct this problem without radically altering the formula? I know that Ramanujan himself anticipated this problem when he wrote this inequality: $$sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1100<n!<sqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac130$$ Could this hold the key? (See Formula 2.1 here)
factorial approximation-theory
factorial approximation-theory
edited Feb 17 '14 at 2:21
asked Feb 15 '14 at 2:31
Brian J. Fink
934615
934615
add a comment |Â
add a comment |Â
4 Answers
4
active
oldest
votes
up vote
8
down vote
Interestingly, if we do a series expansion in Mathematica
Series[(Gamma[n + 1]/Sqrt[Pi] (n/Exp[1])^-n)^6, n, Infinity, 6]
We get $$8 n^3+4 n^2+n+frac130-frac11240 n+frac793360n^2+frac3539201600 n^3-frac9511403200 n^4-frac10051716800n^5+frac2339346916386688000n^6+Oleft(frac1nright)^13/2.$$ This suggests that your ad hoc adjustment of the constant term is probably not strictly justified.
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
2
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
 |Â
show 5 more comments
up vote
6
down vote
accepted
The fraction $tfrac130$ may not be, practically speaking, the best upper bound for the final term of the radicand. Indeed, according to Ramanujan's own notes, the number ranges from $tfrac130$ down to $tfrac1100$. Observe that when evaluated at $0$, $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac130\
&=sqrtpicdot1cdotrootLARGE6offrac130\
&=fracsqrtpirootLARGE6of30\
&=rootLARGE6offracpi^330\
&approx1.00551endalign$$ Notice the error in the result. However, if we replace the number $30$ in the above formula with $pi^3$, the result is dead accurate: $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac1pi^3\
&=sqrtpicdot1cdotrootLARGE6offrac1pi^3\
&=fracsqrtpirootLARGE6ofpi^3\
&=rootLARGE6offracpi^3pi^3\
&=1endalign$$ Now let's try it on $n=1$: $$beginalign1!&approxsqrtpileft(frac1eright)^1rootLARGE6of8cdot1^3+4cdot1^2+1+frac1pi^3\
&=fracsqrtpierootLARGE6of13+frac1pi^3\
&approx1.0002695endalign$$ For this reason, I recommend this modification to Ramanujan's approximation: $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3$$ Alternatively, since $pi^3approx31.00627668$, a slightly less robust adjustment to the formula can be made by substituting $31$ for $30$, instead of $pi^3$.
Let me know what you think about this!
Additional thoughts: Based on the material I added to my question above, perhaps $tfrac1pi^3approx31$ should be gradually reduced toward $tfrac1pi^4approx97$ as $n$ increases. A draft formula, pending further investigation: $$large n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3+c$$ where $$left(fracnn+1right)^3>c>left(fracnn+1right)^2$$ The formula above is constantly evolving as I test and make adjustments. This formula is tricky to adjust. I have to express it in terms of an unknown value $c$ until I can dial it in, so to speak. My current estimate is $$capproxleft(fracnn+1right)^pi^3lower2pt/lower4pt12$$ Conclusion: The answer is no and no. According to my own analysis, Ramanujan's formula is only useful for estimating what the value of $n!$ might be for some $n$; and the error reduction rate appears painfully slow, slow enough to begin to accumulate error in the integer range as early as $11!$; as for tweaking it, the need appears to be for an adjustment of a major sort, which perhaps I will be unable to accomplish at this time. Indeed, any adjustment that optimizes the formula over one range appears to diminish its accuracy over another, as with all asymptotic approximations of Factorial and Gamma functions in general. I'm not saying a formula for the factorial function cannot be found that is optimal for all $xgeqslant0$; I simply have neither the time nor the mathematical expertise to do it myself.
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
2
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
add a comment |Â
up vote
5
down vote
Long time ago, needing an explicit formula for statistical thermodynamics, I was facing the same problem of the calculation of $n!$ for $0<n<1$. Starting from Ramanujan's approximation, what I did was to write $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ What can be easily established is that $$x(0)=frac1pi ^3$$ just as proposed by Brian J. Fink. We can also show that $$x(1/2)=frac18 left(e^3-20right)$$ and $$x(1)=13-frace^6pi ^3$$ and I used (this is totally empirical and cannot be justified) a quadratic expansion of $x(n)=a+b n+c n^2$ which leads to $$a=frac1pi ^3$$ $$b=frac12 left(6+e^3-frac2 left(3+e^6right)pi ^3right)$$ $$c=frac12 left(-32-e^3+frac4 left(1+e^6right)pi ^3right)$$ Again, this has never been supposed to be used outside the range $[0,1]$
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
add a comment |Â
up vote
0
down vote
Back to the problem three and half years later.
Considering heropup's interesting answer, considering
$$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ we can approximate $x(n)$ by $$x(n)=frac130+frac1455925-70798882, n1544702880, n^2+760646880, n+981836548$$ which leads to
$$left(
beginarrayccc
n & n! & textapproximation\
1 & 1 & 1.0000133314197806798 \
2 & 2 & 2.0000005398355538814 \
3 & 6 & 6.0000001098448978182 \
4 & 24 & 24.000000057274931372 \
5 & 120 & 120.00000005587036156 \
6 & 720 & 720.00000008585188238 \
7 & 5040 & 5040.0000001871217948 \
8 & 40320 & 40320.000000539851469 \
9 & 362880 & 362880.00000196433740 \
10 & 3628800 & 3628800.0000087019948\
11 & 39916800 & 39916800.000045696065
endarray
right)$$
This would make heropup's expansion
$$8 n^3+4 n^2+n-frac64416719662944487442944000
, n^5+Oleft(frac1n^6right)$$
add a comment |Â
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
8
down vote
Interestingly, if we do a series expansion in Mathematica
Series[(Gamma[n + 1]/Sqrt[Pi] (n/Exp[1])^-n)^6, n, Infinity, 6]
We get $$8 n^3+4 n^2+n+frac130-frac11240 n+frac793360n^2+frac3539201600 n^3-frac9511403200 n^4-frac10051716800n^5+frac2339346916386688000n^6+Oleft(frac1nright)^13/2.$$ This suggests that your ad hoc adjustment of the constant term is probably not strictly justified.
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
2
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
 |Â
show 5 more comments
up vote
8
down vote
Interestingly, if we do a series expansion in Mathematica
Series[(Gamma[n + 1]/Sqrt[Pi] (n/Exp[1])^-n)^6, n, Infinity, 6]
We get $$8 n^3+4 n^2+n+frac130-frac11240 n+frac793360n^2+frac3539201600 n^3-frac9511403200 n^4-frac10051716800n^5+frac2339346916386688000n^6+Oleft(frac1nright)^13/2.$$ This suggests that your ad hoc adjustment of the constant term is probably not strictly justified.
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
2
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
 |Â
show 5 more comments
up vote
8
down vote
up vote
8
down vote
Interestingly, if we do a series expansion in Mathematica
Series[(Gamma[n + 1]/Sqrt[Pi] (n/Exp[1])^-n)^6, n, Infinity, 6]
We get $$8 n^3+4 n^2+n+frac130-frac11240 n+frac793360n^2+frac3539201600 n^3-frac9511403200 n^4-frac10051716800n^5+frac2339346916386688000n^6+Oleft(frac1nright)^13/2.$$ This suggests that your ad hoc adjustment of the constant term is probably not strictly justified.
Interestingly, if we do a series expansion in Mathematica
Series[(Gamma[n + 1]/Sqrt[Pi] (n/Exp[1])^-n)^6, n, Infinity, 6]
We get $$8 n^3+4 n^2+n+frac130-frac11240 n+frac793360n^2+frac3539201600 n^3-frac9511403200 n^4-frac10051716800n^5+frac2339346916386688000n^6+Oleft(frac1nright)^13/2.$$ This suggests that your ad hoc adjustment of the constant term is probably not strictly justified.
answered Feb 15 '14 at 2:47
heropup
60.4k65895
60.4k65895
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
2
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
 |Â
show 5 more comments
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
2
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I was simply making it more accurate without making it more complex. My goal was not to add more baggage to the equation, but simply to fine-tune it. My results are purely experimental at this point, with no formal mathematical proof; I'm simply musing. But considering that the approximation 1. is greater than every value of the factorial, and 2. less than Ramanujan's approximation in every case, I think I'm on firm ground.
â Brian J. Fink
Feb 15 '14 at 2:58
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
I didn't intend my comment to be a criticism of your adjustment. Indeed, if you look at the series expansion around $n = 1$, your adjustment is in fact superior. The point I was raising is that the series expansion doesn't strictly reflect such a choice.
â heropup
Feb 15 '14 at 3:33
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
That is why they are called "approximations." :-)
â Brian J. Fink
Feb 15 '14 at 3:42
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
As long as you're making comments like that, I think you should be more respectful with your wording: Ramanujan was not "off by a tiny bit." That approximation is completely mathematically justified.
â heropup
Feb 15 '14 at 4:04
2
2
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
@PatrickDaSilva Indeed. This is understood from the code itself: it is the series expansion at $n = infty$, so of course, it is asymptotic for large $n$, not small $n$. Making the adjustment is fine if you want to do small approximations but (1) one should justify it using more than empirical observation, and (2) one should keep in mind that for large $n$, such modifications no longer hold asymptotically. That is why I felt it disrespectful to claim "Ramanujan was off," considering that he was well aware of exactly what he was doing, and under what conditions the expansion holds.
â heropup
Feb 16 '14 at 4:10
 |Â
show 5 more comments
up vote
6
down vote
accepted
The fraction $tfrac130$ may not be, practically speaking, the best upper bound for the final term of the radicand. Indeed, according to Ramanujan's own notes, the number ranges from $tfrac130$ down to $tfrac1100$. Observe that when evaluated at $0$, $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac130\
&=sqrtpicdot1cdotrootLARGE6offrac130\
&=fracsqrtpirootLARGE6of30\
&=rootLARGE6offracpi^330\
&approx1.00551endalign$$ Notice the error in the result. However, if we replace the number $30$ in the above formula with $pi^3$, the result is dead accurate: $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac1pi^3\
&=sqrtpicdot1cdotrootLARGE6offrac1pi^3\
&=fracsqrtpirootLARGE6ofpi^3\
&=rootLARGE6offracpi^3pi^3\
&=1endalign$$ Now let's try it on $n=1$: $$beginalign1!&approxsqrtpileft(frac1eright)^1rootLARGE6of8cdot1^3+4cdot1^2+1+frac1pi^3\
&=fracsqrtpierootLARGE6of13+frac1pi^3\
&approx1.0002695endalign$$ For this reason, I recommend this modification to Ramanujan's approximation: $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3$$ Alternatively, since $pi^3approx31.00627668$, a slightly less robust adjustment to the formula can be made by substituting $31$ for $30$, instead of $pi^3$.
Let me know what you think about this!
Additional thoughts: Based on the material I added to my question above, perhaps $tfrac1pi^3approx31$ should be gradually reduced toward $tfrac1pi^4approx97$ as $n$ increases. A draft formula, pending further investigation: $$large n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3+c$$ where $$left(fracnn+1right)^3>c>left(fracnn+1right)^2$$ The formula above is constantly evolving as I test and make adjustments. This formula is tricky to adjust. I have to express it in terms of an unknown value $c$ until I can dial it in, so to speak. My current estimate is $$capproxleft(fracnn+1right)^pi^3lower2pt/lower4pt12$$ Conclusion: The answer is no and no. According to my own analysis, Ramanujan's formula is only useful for estimating what the value of $n!$ might be for some $n$; and the error reduction rate appears painfully slow, slow enough to begin to accumulate error in the integer range as early as $11!$; as for tweaking it, the need appears to be for an adjustment of a major sort, which perhaps I will be unable to accomplish at this time. Indeed, any adjustment that optimizes the formula over one range appears to diminish its accuracy over another, as with all asymptotic approximations of Factorial and Gamma functions in general. I'm not saying a formula for the factorial function cannot be found that is optimal for all $xgeqslant0$; I simply have neither the time nor the mathematical expertise to do it myself.
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
2
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
add a comment |Â
up vote
6
down vote
accepted
The fraction $tfrac130$ may not be, practically speaking, the best upper bound for the final term of the radicand. Indeed, according to Ramanujan's own notes, the number ranges from $tfrac130$ down to $tfrac1100$. Observe that when evaluated at $0$, $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac130\
&=sqrtpicdot1cdotrootLARGE6offrac130\
&=fracsqrtpirootLARGE6of30\
&=rootLARGE6offracpi^330\
&approx1.00551endalign$$ Notice the error in the result. However, if we replace the number $30$ in the above formula with $pi^3$, the result is dead accurate: $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac1pi^3\
&=sqrtpicdot1cdotrootLARGE6offrac1pi^3\
&=fracsqrtpirootLARGE6ofpi^3\
&=rootLARGE6offracpi^3pi^3\
&=1endalign$$ Now let's try it on $n=1$: $$beginalign1!&approxsqrtpileft(frac1eright)^1rootLARGE6of8cdot1^3+4cdot1^2+1+frac1pi^3\
&=fracsqrtpierootLARGE6of13+frac1pi^3\
&approx1.0002695endalign$$ For this reason, I recommend this modification to Ramanujan's approximation: $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3$$ Alternatively, since $pi^3approx31.00627668$, a slightly less robust adjustment to the formula can be made by substituting $31$ for $30$, instead of $pi^3$.
Let me know what you think about this!
Additional thoughts: Based on the material I added to my question above, perhaps $tfrac1pi^3approx31$ should be gradually reduced toward $tfrac1pi^4approx97$ as $n$ increases. A draft formula, pending further investigation: $$large n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3+c$$ where $$left(fracnn+1right)^3>c>left(fracnn+1right)^2$$ The formula above is constantly evolving as I test and make adjustments. This formula is tricky to adjust. I have to express it in terms of an unknown value $c$ until I can dial it in, so to speak. My current estimate is $$capproxleft(fracnn+1right)^pi^3lower2pt/lower4pt12$$ Conclusion: The answer is no and no. According to my own analysis, Ramanujan's formula is only useful for estimating what the value of $n!$ might be for some $n$; and the error reduction rate appears painfully slow, slow enough to begin to accumulate error in the integer range as early as $11!$; as for tweaking it, the need appears to be for an adjustment of a major sort, which perhaps I will be unable to accomplish at this time. Indeed, any adjustment that optimizes the formula over one range appears to diminish its accuracy over another, as with all asymptotic approximations of Factorial and Gamma functions in general. I'm not saying a formula for the factorial function cannot be found that is optimal for all $xgeqslant0$; I simply have neither the time nor the mathematical expertise to do it myself.
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
2
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
The fraction $tfrac130$ may not be, practically speaking, the best upper bound for the final term of the radicand. Indeed, according to Ramanujan's own notes, the number ranges from $tfrac130$ down to $tfrac1100$. Observe that when evaluated at $0$, $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac130\
&=sqrtpicdot1cdotrootLARGE6offrac130\
&=fracsqrtpirootLARGE6of30\
&=rootLARGE6offracpi^330\
&approx1.00551endalign$$ Notice the error in the result. However, if we replace the number $30$ in the above formula with $pi^3$, the result is dead accurate: $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac1pi^3\
&=sqrtpicdot1cdotrootLARGE6offrac1pi^3\
&=fracsqrtpirootLARGE6ofpi^3\
&=rootLARGE6offracpi^3pi^3\
&=1endalign$$ Now let's try it on $n=1$: $$beginalign1!&approxsqrtpileft(frac1eright)^1rootLARGE6of8cdot1^3+4cdot1^2+1+frac1pi^3\
&=fracsqrtpierootLARGE6of13+frac1pi^3\
&approx1.0002695endalign$$ For this reason, I recommend this modification to Ramanujan's approximation: $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3$$ Alternatively, since $pi^3approx31.00627668$, a slightly less robust adjustment to the formula can be made by substituting $31$ for $30$, instead of $pi^3$.
Let me know what you think about this!
Additional thoughts: Based on the material I added to my question above, perhaps $tfrac1pi^3approx31$ should be gradually reduced toward $tfrac1pi^4approx97$ as $n$ increases. A draft formula, pending further investigation: $$large n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3+c$$ where $$left(fracnn+1right)^3>c>left(fracnn+1right)^2$$ The formula above is constantly evolving as I test and make adjustments. This formula is tricky to adjust. I have to express it in terms of an unknown value $c$ until I can dial it in, so to speak. My current estimate is $$capproxleft(fracnn+1right)^pi^3lower2pt/lower4pt12$$ Conclusion: The answer is no and no. According to my own analysis, Ramanujan's formula is only useful for estimating what the value of $n!$ might be for some $n$; and the error reduction rate appears painfully slow, slow enough to begin to accumulate error in the integer range as early as $11!$; as for tweaking it, the need appears to be for an adjustment of a major sort, which perhaps I will be unable to accomplish at this time. Indeed, any adjustment that optimizes the formula over one range appears to diminish its accuracy over another, as with all asymptotic approximations of Factorial and Gamma functions in general. I'm not saying a formula for the factorial function cannot be found that is optimal for all $xgeqslant0$; I simply have neither the time nor the mathematical expertise to do it myself.
The fraction $tfrac130$ may not be, practically speaking, the best upper bound for the final term of the radicand. Indeed, according to Ramanujan's own notes, the number ranges from $tfrac130$ down to $tfrac1100$. Observe that when evaluated at $0$, $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac130\
&=sqrtpicdot1cdotrootLARGE6offrac130\
&=fracsqrtpirootLARGE6of30\
&=rootLARGE6offracpi^330\
&approx1.00551endalign$$ Notice the error in the result. However, if we replace the number $30$ in the above formula with $pi^3$, the result is dead accurate: $$beginalign0!&approxsqrtpileft(frac0eright)^0rootLARGE6of8cdot0^3+4cdot0^2+0+frac1pi^3\
&=sqrtpicdot1cdotrootLARGE6offrac1pi^3\
&=fracsqrtpirootLARGE6ofpi^3\
&=rootLARGE6offracpi^3pi^3\
&=1endalign$$ Now let's try it on $n=1$: $$beginalign1!&approxsqrtpileft(frac1eright)^1rootLARGE6of8cdot1^3+4cdot1^2+1+frac1pi^3\
&=fracsqrtpierootLARGE6of13+frac1pi^3\
&approx1.0002695endalign$$ For this reason, I recommend this modification to Ramanujan's approximation: $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3$$ Alternatively, since $pi^3approx31.00627668$, a slightly less robust adjustment to the formula can be made by substituting $31$ for $30$, instead of $pi^3$.
Let me know what you think about this!
Additional thoughts: Based on the material I added to my question above, perhaps $tfrac1pi^3approx31$ should be gradually reduced toward $tfrac1pi^4approx97$ as $n$ increases. A draft formula, pending further investigation: $$large n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+frac1pi^3+c$$ where $$left(fracnn+1right)^3>c>left(fracnn+1right)^2$$ The formula above is constantly evolving as I test and make adjustments. This formula is tricky to adjust. I have to express it in terms of an unknown value $c$ until I can dial it in, so to speak. My current estimate is $$capproxleft(fracnn+1right)^pi^3lower2pt/lower4pt12$$ Conclusion: The answer is no and no. According to my own analysis, Ramanujan's formula is only useful for estimating what the value of $n!$ might be for some $n$; and the error reduction rate appears painfully slow, slow enough to begin to accumulate error in the integer range as early as $11!$; as for tweaking it, the need appears to be for an adjustment of a major sort, which perhaps I will be unable to accomplish at this time. Indeed, any adjustment that optimizes the formula over one range appears to diminish its accuracy over another, as with all asymptotic approximations of Factorial and Gamma functions in general. I'm not saying a formula for the factorial function cannot be found that is optimal for all $xgeqslant0$; I simply have neither the time nor the mathematical expertise to do it myself.
edited Feb 20 '14 at 20:06
community wiki
19 revs
Brian J. Fink
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
2
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
add a comment |Â
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
2
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
I tried applying a similar adjustment to Gosper's approximation, but it seems not to help that one.
â Brian J. Fink
Feb 15 '14 at 5:28
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
So you mean $0^0 = 1$?
â Soham Chowdhury
Feb 15 '14 at 8:01
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
@Soham, yes it is. Any number to the zeroth power is 1.
â Brian J. Fink
Feb 15 '14 at 20:15
2
2
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
I'm not sure if you've grokked this, so I feel I should point out that tweaking the constants in a truncated Taylor series always makes the approximation worse for sufficiently large $n$. All you can hope to gain from tweaking the values of the constants is to get a better fit for smaller values of $n$.
â Hurkyl
Feb 16 '14 at 22:58
add a comment |Â
up vote
5
down vote
Long time ago, needing an explicit formula for statistical thermodynamics, I was facing the same problem of the calculation of $n!$ for $0<n<1$. Starting from Ramanujan's approximation, what I did was to write $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ What can be easily established is that $$x(0)=frac1pi ^3$$ just as proposed by Brian J. Fink. We can also show that $$x(1/2)=frac18 left(e^3-20right)$$ and $$x(1)=13-frace^6pi ^3$$ and I used (this is totally empirical and cannot be justified) a quadratic expansion of $x(n)=a+b n+c n^2$ which leads to $$a=frac1pi ^3$$ $$b=frac12 left(6+e^3-frac2 left(3+e^6right)pi ^3right)$$ $$c=frac12 left(-32-e^3+frac4 left(1+e^6right)pi ^3right)$$ Again, this has never been supposed to be used outside the range $[0,1]$
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
add a comment |Â
up vote
5
down vote
Long time ago, needing an explicit formula for statistical thermodynamics, I was facing the same problem of the calculation of $n!$ for $0<n<1$. Starting from Ramanujan's approximation, what I did was to write $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ What can be easily established is that $$x(0)=frac1pi ^3$$ just as proposed by Brian J. Fink. We can also show that $$x(1/2)=frac18 left(e^3-20right)$$ and $$x(1)=13-frace^6pi ^3$$ and I used (this is totally empirical and cannot be justified) a quadratic expansion of $x(n)=a+b n+c n^2$ which leads to $$a=frac1pi ^3$$ $$b=frac12 left(6+e^3-frac2 left(3+e^6right)pi ^3right)$$ $$c=frac12 left(-32-e^3+frac4 left(1+e^6right)pi ^3right)$$ Again, this has never been supposed to be used outside the range $[0,1]$
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
add a comment |Â
up vote
5
down vote
up vote
5
down vote
Long time ago, needing an explicit formula for statistical thermodynamics, I was facing the same problem of the calculation of $n!$ for $0<n<1$. Starting from Ramanujan's approximation, what I did was to write $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ What can be easily established is that $$x(0)=frac1pi ^3$$ just as proposed by Brian J. Fink. We can also show that $$x(1/2)=frac18 left(e^3-20right)$$ and $$x(1)=13-frace^6pi ^3$$ and I used (this is totally empirical and cannot be justified) a quadratic expansion of $x(n)=a+b n+c n^2$ which leads to $$a=frac1pi ^3$$ $$b=frac12 left(6+e^3-frac2 left(3+e^6right)pi ^3right)$$ $$c=frac12 left(-32-e^3+frac4 left(1+e^6right)pi ^3right)$$ Again, this has never been supposed to be used outside the range $[0,1]$
Long time ago, needing an explicit formula for statistical thermodynamics, I was facing the same problem of the calculation of $n!$ for $0<n<1$. Starting from Ramanujan's approximation, what I did was to write $$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ What can be easily established is that $$x(0)=frac1pi ^3$$ just as proposed by Brian J. Fink. We can also show that $$x(1/2)=frac18 left(e^3-20right)$$ and $$x(1)=13-frace^6pi ^3$$ and I used (this is totally empirical and cannot be justified) a quadratic expansion of $x(n)=a+b n+c n^2$ which leads to $$a=frac1pi ^3$$ $$b=frac12 left(6+e^3-frac2 left(3+e^6right)pi ^3right)$$ $$c=frac12 left(-32-e^3+frac4 left(1+e^6right)pi ^3right)$$ Again, this has never been supposed to be used outside the range $[0,1]$
edited Feb 15 '14 at 8:19
answered Feb 15 '14 at 7:53
Claude Leibovici
113k1155127
113k1155127
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
add a comment |Â
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
I know the formula can be improved further; I simply wanted to make a minor adjustment to a formula that is greater than $n!$ for all $n$. I'm going for simplicity, not further complication.
â Brian J. Fink
Feb 15 '14 at 18:34
add a comment |Â
up vote
0
down vote
Back to the problem three and half years later.
Considering heropup's interesting answer, considering
$$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ we can approximate $x(n)$ by $$x(n)=frac130+frac1455925-70798882, n1544702880, n^2+760646880, n+981836548$$ which leads to
$$left(
beginarrayccc
n & n! & textapproximation\
1 & 1 & 1.0000133314197806798 \
2 & 2 & 2.0000005398355538814 \
3 & 6 & 6.0000001098448978182 \
4 & 24 & 24.000000057274931372 \
5 & 120 & 120.00000005587036156 \
6 & 720 & 720.00000008585188238 \
7 & 5040 & 5040.0000001871217948 \
8 & 40320 & 40320.000000539851469 \
9 & 362880 & 362880.00000196433740 \
10 & 3628800 & 3628800.0000087019948\
11 & 39916800 & 39916800.000045696065
endarray
right)$$
This would make heropup's expansion
$$8 n^3+4 n^2+n-frac64416719662944487442944000
, n^5+Oleft(frac1n^6right)$$
add a comment |Â
up vote
0
down vote
Back to the problem three and half years later.
Considering heropup's interesting answer, considering
$$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ we can approximate $x(n)$ by $$x(n)=frac130+frac1455925-70798882, n1544702880, n^2+760646880, n+981836548$$ which leads to
$$left(
beginarrayccc
n & n! & textapproximation\
1 & 1 & 1.0000133314197806798 \
2 & 2 & 2.0000005398355538814 \
3 & 6 & 6.0000001098448978182 \
4 & 24 & 24.000000057274931372 \
5 & 120 & 120.00000005587036156 \
6 & 720 & 720.00000008585188238 \
7 & 5040 & 5040.0000001871217948 \
8 & 40320 & 40320.000000539851469 \
9 & 362880 & 362880.00000196433740 \
10 & 3628800 & 3628800.0000087019948\
11 & 39916800 & 39916800.000045696065
endarray
right)$$
This would make heropup's expansion
$$8 n^3+4 n^2+n-frac64416719662944487442944000
, n^5+Oleft(frac1n^6right)$$
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Back to the problem three and half years later.
Considering heropup's interesting answer, considering
$$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ we can approximate $x(n)$ by $$x(n)=frac130+frac1455925-70798882, n1544702880, n^2+760646880, n+981836548$$ which leads to
$$left(
beginarrayccc
n & n! & textapproximation\
1 & 1 & 1.0000133314197806798 \
2 & 2 & 2.0000005398355538814 \
3 & 6 & 6.0000001098448978182 \
4 & 24 & 24.000000057274931372 \
5 & 120 & 120.00000005587036156 \
6 & 720 & 720.00000008585188238 \
7 & 5040 & 5040.0000001871217948 \
8 & 40320 & 40320.000000539851469 \
9 & 362880 & 362880.00000196433740 \
10 & 3628800 & 3628800.0000087019948\
11 & 39916800 & 39916800.000045696065
endarray
right)$$
This would make heropup's expansion
$$8 n^3+4 n^2+n-frac64416719662944487442944000
, n^5+Oleft(frac1n^6right)$$
Back to the problem three and half years later.
Considering heropup's interesting answer, considering
$$n!approxsqrtpileft(fracneright)^nrootLARGE6of8n^3+4n^2+n+x(n)$$ we can approximate $x(n)$ by $$x(n)=frac130+frac1455925-70798882, n1544702880, n^2+760646880, n+981836548$$ which leads to
$$left(
beginarrayccc
n & n! & textapproximation\
1 & 1 & 1.0000133314197806798 \
2 & 2 & 2.0000005398355538814 \
3 & 6 & 6.0000001098448978182 \
4 & 24 & 24.000000057274931372 \
5 & 120 & 120.00000005587036156 \
6 & 720 & 720.00000008585188238 \
7 & 5040 & 5040.0000001871217948 \
8 & 40320 & 40320.000000539851469 \
9 & 362880 & 362880.00000196433740 \
10 & 3628800 & 3628800.0000087019948\
11 & 39916800 & 39916800.000045696065
endarray
right)$$
This would make heropup's expansion
$$8 n^3+4 n^2+n-frac64416719662944487442944000
, n^5+Oleft(frac1n^6right)$$
answered Oct 27 '17 at 7:05
Claude Leibovici
113k1155127
113k1155127
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f676952%2fis-ramanujans-approximation-for-the-factorial-optimal-or-can-it-be-tweaked-a%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password