Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Sep 8, 2004 #1

    tony873004

    User Avatar
    Science Advisor
    Gold Member

    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! ??
     
  2. jcsd
  3. Sep 8, 2004 #2

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  4. Sep 8, 2004 #3

    Janitor

    User Avatar
    Science Advisor

    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
     
  5. Sep 8, 2004 #4

    tony873004

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  6. Sep 8, 2004 #5

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    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.
     
  7. Sep 9, 2004 #6

    tony873004

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  8. Sep 9, 2004 #7

    Tide

    User Avatar
    Science Advisor
    Homework Helper

    No. You would branch to one of two subroutines - one for integer values and one for noninteger values.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?