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