2017年4月18日火曜日

学習環境

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


    1. 7! 2!1!4! =105

    2. 7! 0!3!4! =35

    3. 6! 1!2!3!0! =60

    4. 6! 2!2!1!1! =180

  1. 6! p!q!r! ( x ) p ( 2y ) q 5 r = 6! p!q!r! ( 2 ) q 5 r · x p y q p=2,q=4,r=624=0 6! 2!4!0! · ( 2 ) 4 5 0 =15·16=240 p=2,q=1,r=6pq=3 6! 2!1!3! ( 2 ) 1 5 3 =60·250=15000 p=1,q=1,r=611=4 6! 1!1!4! ( 2 ) 1 5 4 =30·2·625=37500

  2. 7! p!q!r! ( x 2 ) p ( 3x ) q 4 r = 7! p!q!r! ( 3 ) q 4 r x 2p+q 2p+q=2 p=0,q=2,r=5 p=1,q=0,r=6 7! 0!2!5! ( 3 ) 2 4 5 + 7! 1!0!6! ( 3 ) 0 4 6 =21·9· 4 5 +7· 4 6 = 4 5 ( 189+28 ) =1024·217 =222208 2p+q=5 p=0,q=5,r=2 p=1,q=3,r=3 p=2,q=1,r=4 7! 0!5!2! ( 3 ) 5 4 2 + 7! 1!3!3! ( 3 ) 3 4 3 + 7! 2!1!4! ( 3 ) 1 4 4 =21 ( 3 ) 5 4 2 +140 ( 3 ) 3 4 3 +105( 3 ) 4 4 =( 3 ) 4 2 ( 21· ( 3 ) 4 +140 ( 3 ) 2 ·4+105· 4 2 ) =48( 1701+5040+1680 ) =404208 2p+q=10 p=3,q=4,r=0 p=4,q=2,r=1 p=5,q=0,r=2 7! 3!4!0! ( 3 ) 4 4 0 + 7! 4!2!1! ( 3 ) 2 4 1 + 7! 5!0!2! ( 3 ) 0 4 2 =35·81+105·9·4+21·16 =2835+3780+336 =6951

コード(Emacs)

HTML5

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

JavaScript

let 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 multinomialCoefficient = (n, ...args) => {
    return factorial(n) / args.map(factorial).reduce((x, y) => x * y);
};

let output = () => {        
    p('43-1.');
    p(multinomialCoefficient(7, 2, 1, 4));
    p('43-2.');
    p(multinomialCoefficient(7, 1, 3, 4));
    p('43-3.');
    p(multinomialCoefficient(6, 1, 2, 3));
    p('43-4.');
    p(multinomialCoefficient(6, 2, 2, 1, 1));
    p('44.');
    p(multinomialCoefficient(6, 2, 4, 0) * Math.pow(-2, 4))
    p(multinomialCoefficient(6, 2, 1, 3) * -2 * Math.pow(5, 3));
    p(multinomialCoefficient(6, 1, 1, 4) * -2 * Math.pow(5, 4));
    p('45.');
    p(multinomialCoefficient(7, 0, 2, 5) * Math.pow(-3, 2) * Math.pow(4, 5) +
      multinomialCoefficient(7, 1, 0, 6) * 1 * Math.pow(4, 6));
    p(multinomialCoefficient(7, 0, 5, 2) * Math.pow(-3, 5) * Math.pow(4, 2) +
      multinomialCoefficient(7, 1, 3, 3) * Math.pow(-3, 3) * Math.pow(4, 3) +
      multinomialCoefficient(7, 2, 1, 4) * Math.pow(-3, 1) * Math.pow(4, 4));
    p(multinomialCoefficient(7, 3, 4, 0) * Math.pow(-3, 4)  +
      multinomialCoefficient(7, 4, 2, 1) * Math.pow(-3, 2) * 4 +
      multinomialCoefficient(7, 5, 0, 2) * Math.pow(4, 2));
    
};

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

output();














						

0 コメント:

コメントを投稿