Created
September 18, 2017 22:12
-
-
Save tomtung/5f9abd185fb5852c786349fa689b3960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" class="client-js"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Propensity</title> | |
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" /> | |
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script> | |
</head> | |
<body> | |
<div id="jxgbox" class="jxgbox" style="width:1000px; height:800px;"></div> | |
<script type="text/javascript"> | |
/* <![CDATA[ */ | |
JXG.Options.text.useMathJax = true; | |
var N = 100000, | |
max_Nl = Math.log(N), | |
brd = JXG.JSXGraph.initBoard( | |
'jxgbox', | |
{ | |
boundingbox: [-1, 1, max_Nl, -.1], | |
axis: true, | |
grid: true, | |
showCopyright: false | |
} | |
), | |
A = brd.create( | |
'slider', | |
[[8, .2], [10,.2], [0,0.55,5]], | |
{name:'A', snapWidth:.01} | |
), | |
B = brd.create( | |
'slider', | |
[[8, .1], [10, .1], [-1,1.5,10]], | |
{name:'B', snapWidth:.01} | |
); | |
brd.create('text', [.1, .98, function() { | |
var C_val = ((Math.log(N) - 1) * Math.pow(B.Value() + 1, A.Value())).toFixed(2); | |
A_val = A.Value().toFixed(2), | |
B_val = B.Value().toFixed(2); | |
return '\\[p_l = \\left(1 + ' + C_val + ' e^{ -' + A_val + ' \\log{(N_l + ' + B_val + ')}}\\right) ^ {-1}\\]'; | |
}], {fontSize:15}); | |
brd.create('text', [10.6, -.03, function() { | |
return '\\[ \\log N_l \\]'; | |
}], {fontSize:15}); | |
brd.create('functiongraph',[function(log_Nl){ | |
var Nl = Math.exp(log_Nl); | |
var C = (Math.log(N) - 1) * Math.pow(B.Value() + 1, A.Value()); | |
var result = 1 / ( | |
1 + C * Math.exp( | |
-A.Value() * Math.log(Nl + B.Value()) | |
) | |
); | |
return result; | |
}]); | |
/* ]]> */ | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment