2017年4月16日日曜日

学習環境

数学読本〈4〉数列の極限,順列/順列・組合せ/確率/関数の極限と微分法(松坂 和夫(著)、岩波書店)の第15章(「場合の数」 を数える - 順列・組合せ)、15.3(二項定理)、二項定理の応用、二項定理の性質、問38、39.を取り組んでみる。


  1. ( 9 r ) x r ( − 1 x ) 9−r =( 9 r ) ( −1 ) 9−r x 2r−9 2r−9=3 r=6 ( 9 6 ) ( −1 ) 9−6 =− 9·8·7 3·2·1 =−84 x 3 の係数は−84。 2r−9=2 x 2 の係数は0。 2r−9=−1 r=4 ( 9 4 ) ( −1 ) 9−4 =−1· 9·8·7·6 4·3·2·1 =−126 x −1 の係数は−126。

  2. ( 6 r ) ( 3 x 2 ) r ( 1 2x ) 6−r =( 6 r )· 3 r · 2 r−6 · x 3r−6 3r−6=6 r=4 ( 6 4 )· 3 4 · 2 4−6 =15·81· 1 4 = 1215 4 x 6 の係数は 1215 4 。 3r−6=4 x 4 の係数は0。 3r−6=−3 r=1 ( 6 1 )·3· 2 1−6 = 18 32 = 9 16 x −3 の係数は 9 16 。 3r−6=0 r=2 ( 6 2 )· 3 2 · 2 2−6 =15·9· 1 16 = 135 16 定数項は 135 16 。

コード(Emacs)

HTML5

<button id="run0">run</button>
<button id="clear0">clear</button>
<pre id="output0"></pre>
<script src="sample38.js"></script>

JavaScript

let input0 = document.querySelector('#n0'),
    btn0 = document.querySelector('#run0'),
    btn1 = document.querySelector('#clear0'),
    pre0 = document.querySelector('#output0'),
    p = (x) => pre0.textContent += x + '\n';

let range = (start, end, step=1) => {
    let iter = (i, result) => {
        return i >= end ? result : iter(i + step, result.concat([i]));
    }
    return iter(start, []);
};
let factorial = (n) => {
    return n <= 1 ? 1 : n * factorial(n - 1);
};

let combination = (n, r) => {
    return factorial(n) / (factorial(r) * factorial(n - r));
};
let output = () => {
    p('38.');
    p(combination(9, 6) * Math.pow(-1, 9 - 6));
    p(combination(9, 4), Math.pow(-1,  9 - 4));
    p('39.');
    p(combination(6, 4) * Math.pow(3, 4), Math.pow(2, 4 - 6));
    p(combination(6, 1) * 3 * Math.pow(2, 1 - 6) === 9 / 16);
    p(combination(6, 2) * Math.pow(3, 2) * Math.pow(2, 2 - 6) === 135 / 16);
};

btn0.onclick = output;
btn1.onclick = () => {
    pre0.textContent = '';
};

output();














						

0 コメント:

コメントを投稿