Skip to content

Instantly share code, notes, and snippets.

@sasekazu
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasekazu/1c1acd437b7a4466d50c to your computer and use it in GitHub Desktop.
Save sasekazu/1c1acd437b7a4466d50c to your computer and use it in GitHub Desktop.
ロジスティック写像の分岐図
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>logistic</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
var a0 = 2.5;
var x0 = 0.1;
var a = a0;
function loop(){
var x = x0;
a += 0.001;
for(var i=0; i<100; ++i){
x = a*x*(1-x);
}
for(var i=0; i<100; ++i){
x = a*x*(1-x);
ctx.fillRect((a-a0)*600,x*600,1,1);
}
if(a<4.0){
setTimeout(loop, 0);
}
};
loop();
} );
</script>
</head>
<body>
<div style="margin: 0 auto; width: 910px;">
<canvas id="myCanvas" width="900" height="600" style="border: solid 1px;"></canvas><br />
<a href="https://gist.github.com/sasekazu/1c1acd437b7a4466d50c#file-gistfile1-js">ソースコード</a>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment