chore(learn): Applied MDX format to Chinese curriculum files (#40462)
This commit is contained in:
@ -1,72 +1,59 @@
|
||||
---
|
||||
id: 5a23c84252665b21eecc7e76
|
||||
title: 伽玛功能
|
||||
challengeType: 5
|
||||
videoUrl: ''
|
||||
title: 伽玛功能
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id="description">实现一个算法(或更多)来计算<a href="https://en.wikipedia.org/wiki/Gamma function">Gamma</a> ($ \ Gamma $)函数(仅在实际字段中)。 Gamma功能可以定义为: <div style="padding-left: 4em;"> <big><big>$ \ Gamma(x)= \ displaystyle \ int_0 ^ \ infty t ^ {x-1} e ^ { - t} dt $</big></big> </div></section>
|
||||
# --description--
|
||||
|
||||
## Instructions
|
||||
<section id="instructions">
|
||||
</section>
|
||||
实现一个算法(或更多)来计算[Gamma](<https://en.wikipedia.org/wiki/Gamma function>) ($ \\ Gamma $)函数(仅在实际字段中)。 Gamma功能可以定义为:
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
$ \\ Gamma(x)= \\ displaystyle \\ int_0 ^ \\ infty t ^ {x-1} e ^ { - t} dt $
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>gamma</code>应该是一个功能。
|
||||
testString: assert(typeof gamma=='function')
|
||||
- text: '<code>gamma("+tests[0]+")</code>应该返回一个数字。'
|
||||
testString: assert(typeof gamma(.1)=='number')
|
||||
- text: '<code>gamma("+tests[0]+")</code>应该返回<code>"+results[0]+"</code> 。'
|
||||
testString: assert.equal(round(gamma(.1)), round(9.513507698668736))
|
||||
- text: '<code>gamma("+tests[1]+")</code>应该返回<code>"+results[1]+"</code> 。'
|
||||
testString: assert.equal(round(gamma(.2)), round(4.590843711998803))
|
||||
- text: '<code>gamma("+tests[2]+")</code>应该返回<code>"+results[2]+"</code> 。'
|
||||
testString: assert.equal(round(gamma(.3)), round(2.9915689876875904))
|
||||
- text: '<code>gamma("+tests[3]+")</code>应该返回<code>"+results[3]+"</code> 。'
|
||||
testString: assert.equal(round(gamma(.4)), round(2.218159543757687))
|
||||
- text: '<code>gamma("+tests[4]+")</code>应返回<code>"+results[4]+"</code> 。'
|
||||
testString: assert.equal(round(gamma(.5)), round(1.7724538509055159))
|
||||
# --hints--
|
||||
|
||||
```
|
||||
|
||||
</section>
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
|
||||
<div id='js-seed'>
|
||||
`gamma`应该是一个功能。
|
||||
|
||||
```js
|
||||
function gamma (x) {
|
||||
// Good luck!
|
||||
}
|
||||
|
||||
assert(typeof gamma == 'function');
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
### After Test
|
||||
<div id='js-teardown'>
|
||||
`gamma("+tests[0]+")`应该返回一个数字。
|
||||
|
||||
```js
|
||||
console.info('after the test');
|
||||
assert(typeof gamma(0.1) == 'number');
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
`gamma("+tests[0]+")`应该返回`"+results[0]+"` 。
|
||||
|
||||
```js
|
||||
// solution required
|
||||
assert.equal(round(gamma(0.1)), round(9.513507698668736));
|
||||
```
|
||||
|
||||
/section>
|
||||
`gamma("+tests[1]+")`应该返回`"+results[1]+"` 。
|
||||
|
||||
```js
|
||||
assert.equal(round(gamma(0.2)), round(4.590843711998803));
|
||||
```
|
||||
|
||||
`gamma("+tests[2]+")`应该返回`"+results[2]+"` 。
|
||||
|
||||
```js
|
||||
assert.equal(round(gamma(0.3)), round(2.9915689876875904));
|
||||
```
|
||||
|
||||
`gamma("+tests[3]+")`应该返回`"+results[3]+"` 。
|
||||
|
||||
```js
|
||||
assert.equal(round(gamma(0.4)), round(2.218159543757687));
|
||||
```
|
||||
|
||||
`gamma("+tests[4]+")`应返回`"+results[4]+"` 。
|
||||
|
||||
```js
|
||||
assert.equal(round(gamma(0.5)), round(1.7724538509055159));
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
||||
|
Reference in New Issue
Block a user