2017年4月24日月曜日

学習環境

数学読本〈4〉数列の極限,順列/順列・組合せ/確率/関数の極限と微分法(松坂 和夫(著)、岩波書店)の第16章(確からしさをみる - 確率)、16.1(確率とその基本性質)、確率の計算、問6、7、8、9、10、11.を取り組んでみる。


  1. 1 1 2 5 = 31 32

    1. ( 5 2 ) ( 20 2 ) = 10 190 = 1 19

    2. 1 ( 15 2 ) ( 20 2 ) =1 105 190 =1 21 38 = 17 38

    3. 1 ( 15 3 ) ( 20 3 ) =1 15·14·13 20·19·18 =1 7·13 4·19·3 =1 91 228 = 137 228

    4. 1 ( 15 3 )+( 5 3 ) ( 20 3 ) =1 15·14·13+5·4·3 20·19·18 =1 14·13+4 4·19·6 =1 93 12·19 = 135 228 = 45 76

    1. 1 4 3 6 3 =1 2 3 3 3 =1 8 27 = 19 27

    2. 1 2 3 6 3 =1 1 27 = 26 27

    3. ( 1 4 3 6 3 )+( 1 4 3 6 3 )( 1 2 3 6 3 )= 12 27 = 4 9

    1. ( 3 2 )+( 4 2 )+( 5 2 ) ( 12 2 ) = 3·2+4·3+5·4 12·11 = 38 132 = 19 66

    2. 1 ( 7 2 ) ( 12 2 ) =1 7·6 12·11 =1 7 22 = 15 22

    1. p n = ( n 2 )+( n 2 ) ( 2n 2 ) = 2n( n1 ) 2n( 2n1 ) = n1 2n1 q n =1 n1 2n1 = 2n1n+1 2n1 = n 2n1

    2. p n < q n

    3. lim n p n = lim n n1 2n1 = 1 2 lim n q n = lim n n 2n1 = 1 2

コード(Emacs)

HTML5

<div id="graph0"></div>
<pre id="output0"></pre>
n = <input id="n0" type="number" min="2" step="1" value="100">
<br>
<button id="draw0">draw</button>
<button id="clear0">clear</button>

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.6/d3.min.js" integrity="sha256-5idA201uSwHAROtCops7codXJ0vja+6wbBrZdQ6ETQc=" crossorigin="anonymous"></script>
<script src="sample6.js"></script>    

JavaScript

let div0 = document.querySelector('#graph0'),
    input0 = document.querySelector('#n0'),
    pre0 = document.querySelector('#output0'),
    width = 600,
    height = 600,
    padding = 20,
    btn0 = document.querySelector('#draw0'),
    btn1 = document.querySelector('#clear0'),
    p = (x) => pre0.textContent += x + '\n',
    pn = (n) => (n - 1) / (2 * n - 1),
    qn = (n) => n / (2 * n - 1);

let draw = () => {
    let points = [],
        n = parseInt(input0.value, 10);

    for (let i = 2; i <= n; i += 1) {
        points.push([i, pn(i)]);
    }
    for (let i = 2; i <= n; i += 1) {
        points.push([i, qn(i)]);
    }
    let xscale = d3.scaleLinear()
        .domain([2, n])
        .range([padding, width - padding]);
    let ys = points.map((a) => a[1]);
    let yscale = d3.scaleLinear()
        .domain([Math.min(...ys), Math.max(...ys)])
        .range([height - padding, padding]);

    let xaxis = d3.axisBottom().scale(xscale);
    let yaxis = d3.axisLeft().scale(yscale);
    div0.innerHTML = '';
    let svg = d3.select('#graph0')
        .append('svg')
        .attr('width', width)
        .attr('height', height);

    let t = points.length / 2;
    svg.selectAll('circle')
        .data(points)
        .enter()
        .append('circle')
        .attr('cx', (d) => xscale(d[0]))
        .attr('cy', (d) => yscale(d[1]))
        .attr('r', 1)
        .attr('fill', (d, i) => i < t ? 'green' : 'blue');

    svg.append('g')
        .attr('transform', `translate(0, ${height - padding})`)
        .call(xaxis);

    svg.append('g')
        .attr('transform', `translate(${padding}, 0)`)
        .call(yaxis);
    p('n, pn, qn, difference');
    for (let i = 2; i <= n; i += 1) {
        let a = pn(i),
            b = qn(i);
        p(`${i}, ${a}, ${b}, ${b - a}`);
    }
}

input0.onchange = draw;
btn0.onclick = draw;
btn1.onclick = () => pre0.textContent = '';

draw();

n = 

0 コメント:

コメントを投稿

Comments on Google+: