Calculate the Gamma function for half-integer arguments
M, 7 bytes
,0_.!÷/
Try it online! or verify all test cases.
Trivia
Meet M!
M is a fork of Jelly, aimed at mathematical challenges. The core difference between Jelly and M is that M uses infinite precision for all internal calculations, representing results symbolically. Once M is more mature, Jelly will gradually become more multi-purpose and less math-oriented.
M is very much work in progress (full of bugs, and not really that different from Jelly right now), but it works like a charm for this challenge and I just couldn't resist.
How it works
,0_.!÷/ Main link. Argument: n
,0 Pair with 0. Yields [n, 0].
_. Subtract 1/2. Yields [n - 1/2, -1/2].
! Apply the Π function. Yields [Π(n - 1/2), Π(-1/2)] = [Γ(n + 1/2), Γ(1/2)].
÷/ Reduce by division. Yields Γ(n + 1/2) ÷ Γ(1/2) = Γ(n + 1/2) ÷ √π.
Octave, 27 bytes
@(n)rats(gamma(n+.5)/pi^.5)
Built-ins all the way.
Test suite on ideone.
Pyth - 27 26 25 24 bytes
Too cumbersome for my liking. Also, implicit input seems not to work with W
. Uses the second to last first form listed above.
_W<QZ,.!yK.aQ*^*4._QK.!K
Test Suite.