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

  • Thread starter tony873004
  • Start date
In summary, the conversation is about the factorial function and its relationship to the gamma function. The question of how to handle non-integer inputs in a calculator program that mimics the Windows calculator is raised. Suggestions for handling these inputs include creating a table of values for the gamma function and using interpolation or creating separate subroutines for integer and non-integer values. The usefulness of the factorial button on calculators is also discussed.
  • #1
tony873004
Science Advisor
Gold Member
1,752
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
  • #2
The factorial is a special case of the gamma function. The relationship is [itex]x! = \Gamma (x+1)[/itex] and the factorial is usually reserved for nonnegative integers.
 
  • #3
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
 
  • #4
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.
 
  • #5
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 [itex]\Gamma (x)[/itex] for larger x values using the fact that [itex]\Gamma (x+1) = x \Gamma(x)[/itex]. If you want greater accuracy you can write a simple interpolation routine.
 
  • #6
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.
 
  • #7
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.
 

1. What is the formula for calculating N for 6?

The formula for calculating N for 6 is 6*5*4*3*2*1, which is also known as the factorial of 6.

2. Can the formula for N for 6 be applied to the decimal number 6.1?

No, the formula for N for 6 only applies to whole numbers. It cannot be applied to decimal numbers like 6.1.

3. Is there a different formula for calculating N for decimal numbers?

Yes, there is a different formula for calculating N for decimal numbers. It is called the Gamma function and is denoted as Γ(x).

4. How is the Gamma function different from the factorial function?

The Gamma function is an extension of the factorial function and can be used to calculate factorial values for non-integer numbers. It is defined for all complex numbers, unlike the factorial function which is only defined for non-negative integers.

5. What is the value of N for 6.1?

The value of N for 6.1 can be calculated using the Gamma function and is approximately 720.429.

Similar threads

Replies
1
Views
905
  • General Math
Replies
1
Views
763
Replies
55
Views
3K
Replies
1
Views
2K
Replies
7
Views
1K
Replies
6
Views
1K
Replies
3
Views
2K
Replies
5
Views
2K
  • General Math
Replies
9
Views
339
Back
Top