2017年4月15日土曜日

学習環境

解析入門〈1〉(松坂 和夫(著)、岩波書店)の第5章(各種の初等関数)、5.1(対数関数・指数関数)、問題5.1-3、4.を取り組んでみる。


  1. 1 x ( x1 )<logx<1·( x1 ) 1 x < logx x1 <1

  2. x>0 x+1 x 1= x+1x x = 1 x >0 x+1 x >1 1 x+1 x < log x+1 x x+1 x 1 <1 1 x+1 <log x+1 x < 1 x

コード(Emacs)

HTML5

<div id="graph0"></div>

<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="sample3.js"></script>    

JavaScript

let width = 600,
    height = 600,
    padding = 20;

let f = (x) => 1 / x,
    g = (x) => Math.log(x) / (x - 1),
    h = (x) => 1;

let points = [];

for (let x = 1.01; x < 11; x += 0.01) {
    points.push([x, f(x)])
}
for (let x = 1.01; x < 11; x += 0.01) {
    points.push([x, g(x)])
}
for (let x = 1.01; x < 11; x += 0.01) {
    points.push([x, h(x)])
}
let xscale = d3.scaleLinear()
    .domain([-11, 11])
    .range([padding, width - padding]);
let yscale = d3.scaleLinear()
    .domain([-11, 11])
    .range([height - padding, padding]);

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

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 < 1000 ? 'red' : i < 2000 ? 'green' : 'blue');

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

svg.append('g')
    .attr('transform', `translate(${width / 2}, 0)`)
    .call(yaxis);

0 コメント:

コメントを投稿

Comments on Google+: