2017年4月14日金曜日

学習環境

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


  1. a logx loga = e logx loga loga = e logx = e 1logx = x 1 =x log a x= logx loga d dx ( log a x )= 1 xloga

  2. f( x )=x1logx f'( x )=1 1 x x=1 f( x )0

コード(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="sample2.js"></script>    

JavaScript

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

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

let points = [];

for (let x = 0.01; x < 10; x += 0.01) {
    points.push([x, f(x)])
}
for (let x = 0.01; x < 10; x += 0.01) {
    points.push([x, g(x)])
}
let xscale = d3.scaleLinear()
    .domain([-10, 10])
    .range([padding, width - padding]);
let yscale = d3.scaleLinear()
    .domain([-10, 10])
    .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 ? '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 コメント:

コメントを投稿