2018-10-08 17:34:43 +00:00
---
title: Gamma function
id: 5a23c84252665b21eecc7e76
challengeType: 5
2018-10-10 20:20:40 +00:00
videoUrl: ''
localeTitle: Función gamma
2018-10-08 17:34:43 +00:00
---
## Description
2018-10-10 20:20:40 +00:00
< section id = "description" > Implemente un algoritmo (o más) para calcular la función < a href = "https://en.wikipedia.org/wiki/Gamma function" > Gamma</ a > ($ \ Gamma $) (solo en el campo real). La función Gamma se puede definir como: < div style = "padding-left: 4em;" > < big >< big > $ \ Gamma (x) = \ displaystyle \ int_0 ^ \ infty t ^ {x-1} e ^ {- t} dt $</ big ></ big > </ div ></ section >
2018-10-08 17:34:43 +00:00
## Instructions
2018-10-10 20:20:40 +00:00
< section id = "instructions" >
2018-10-08 17:34:43 +00:00
< / section >
## Tests
< section id = 'tests' >
```yml
tests:
- text: < code > gamma</ code > debe ser una función.
testString: 'assert(typeof gamma=="function","< code > gamma< / code > should be a function.")'
2018-10-10 20:20:40 +00:00
- text: '< code > gamma(" +tests[0]+" )</ code > debe devolver un número.'
2018-10-08 17:34:43 +00:00
testString: 'assert(typeof gamma(tests[0])=="number","< code > gamma("+tests[0]+")< / code > should return a number.")'
2018-10-10 20:20:40 +00:00
- text: '< code > gamma(" +tests[0]+" )</ code > debe devolver < code > " +results[0]+" </ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.equal(gamma(tests[0]),results[0],"< code > gamma("+tests[0]+")< / code > should return < code > "+results[0]+"< / code > .")'
2018-10-10 20:20:40 +00:00
- text: '< code > gamma(" +tests[1]+" )</ code > debe devolver < code > " +results[1]+" </ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.equal(gamma(tests[1]),results[1],"< code > gamma("+tests[1]+")< / code > should return < code > "+results[1]+"< / code > .")'
2018-10-10 20:20:40 +00:00
- text: '< code > gamma(" +tests[2]+" )</ code > debe devolver < code > " +results[2]+" </ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.equal(gamma(tests[2]),results[2],"< code > gamma("+tests[2]+")< / code > should return < code > "+results[2]+"< / code > .")'
2018-10-10 20:20:40 +00:00
- text: '< code > gamma(" +tests[3]+" )</ code > debe devolver < code > " +results[3]+" </ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.equal(gamma(tests[3]),results[3],"< code > gamma("+tests[3]+")< / code > should return < code > "+results[3]+"< / code > .")'
2018-10-10 20:20:40 +00:00
- text: '< code > gamma(" +tests[4]+" )</ code > debe devolver < code > " +results[4]+" </ code > .'
2018-10-08 17:34:43 +00:00
testString: 'assert.equal(gamma(tests[4]),results[4],"< code > gamma("+tests[4]+")< / code > should return < code > "+results[4]+"< / code > .")'
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
function gamma (x) {
// Good luck!
}
2018-10-10 20:20:40 +00:00
2018-10-08 17:34:43 +00:00
```
< / div >
### After Test
< div id = 'js-teardown' >
```js
console.info('after the test');
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
2018-10-10 20:20:40 +00:00
// solution required
2018-10-08 17:34:43 +00:00
```
< / section >