1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
<html>
<head>
<title>JSXGraph example</title>
<script type="text/javascript" src="/javascript/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" />
<script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
</head>
<body>
<h1>MathJax</h1>
<div id='jxgbox' class='jxgbox' style='width:600px; height:600px;'></div>
<script type='text/javascript'>
var brd, k;
JXG.Options.text.useMathJax = true;
brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-5,20,5,-5], axis:true, showNavigation:true, showCopyright:true});
k = brd.create('slider',[[-4,-2],[3,-2],[-5,1,5]],{name:'n', snapWidth:1});
brd.create('functiongraph', [function(t) {return Math.pow(Math.E,t*k.Value());}],{strokeColor:'#ff0000'});
brd.create('text',[-4,15,
function() {
var temp;
if (k.Value() == 1) {
temp = '\\[f(x) = e^x \\]';
} else {
temp = '\\[f(x) = e^{' + k.Value() + 'x}\\]';
}
return temp;
}], {fontSize:60});
brd.update();
</script>
</body>
</html>
|