N for 6 is 6*5*4*3*2*1 but what is 6.1 ?

  • Thread starter Thread starter tony873004
  • Start date Start date
AI Thread Summary
The discussion centers on calculating the factorial of non-integer values, specifically 6.1!, which is derived from the gamma function, where x! = Γ(x+1). The user notes that their calculator returns 868.957 for 6.1!, highlighting the need for a program that can handle both integer and non-integer inputs. They express uncertainty about how to manage values between 0 and 1, considering whether to add or multiply them with integer factorials. Suggestions include creating separate subroutines for integer and non-integer values and potentially generating error messages for invalid inputs. The conversation emphasizes the complexity of implementing factorial calculations for non-integers in a calculator program.
tony873004
Science Advisor
Gold Member
Messages
1,753
Reaction score
143
I know that n! for 6 is 6*5*4*3*2*1 but what is 6.1! ? My calculator says 868.957. How do they come up with this?

I'm trying to write a computer program that mimics the calculator program that comes with windows.

I know that using my above formula that I have to make an exception for 0!=1, and Invalid Input for Function for a negative number.

Anything else I should know about n! ??
 
Mathematics news on Phys.org
The factorial is a special case of the gamma function. The relationship is x! = \Gamma (x+1) and the factorial is usually reserved for nonnegative integers.
 
This question crops up here every now and then, I have noticed. Here is one website on the relation between the gamma function and factorials.

http://mathworld.wolfram.com/GammaFunction.html
 
Thanks for your replies. This forum is great!
That link scared me away. I think I might drop the n! button from my calculator since I can't make it do non-integers and the Windows calculator can.
 
Actually, it's not too hard do. You can create a table of values for the gamma function over the interval (0, 1] from which you can obtain values of \Gamma (x) for larger x values using the fact that \Gamma (x+1) = x \Gamma(x). If you want greater accuracy you can write a simple interpolation routine.
 
But what would I do with the values between 0 & 1? Add them to the integer's factorial, or multiply them (probably not. I'm guessing they'd be less than 1, and 6.1! > 6!). I'm not sure I could trust my interpolation routine. If I could come up with that I could probably forget the table altogether. I could also make the Calculator generate an error message on non-integer inputs. Do people ever use the n! button? I never have.
 
tony873004 said:
But what would I do with the values between 0 & 1? Add them to the integer's factorial, or multiply them (probably not. I'm guessing they'd be less than 1, and 6.1! > 6!). I'm not sure I could trust my interpolation routine. If I could come up with that I could probably forget the table altogether. I could also make the Calculator generate an error message on non-integer inputs. Do people ever use the n! button? I never have.

No. You would branch to one of two subroutines - one for integer values and one for noninteger values.
 
Back
Top