Webxcas et exercices intéractifs
Publié : mar. mai 13, 2014 8:50 pm
Bonsoir,
Voici un petit exo intéractif créé avec giac.js, ça peut donner des idées à des collègues qui souhaitent développer des exos html5 pour leurs élèves. J'essaierai de créer un exo intéractif par semaine :
[/color]
Voici un petit exo intéractif créé avec giac.js, ça peut donner des idées à des collègues qui souhaitent développer des exos html5 pour leurs élèves. J'essaierai de créer un exo intéractif par semaine :
Code : Tout sélectionner
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Des exercices intéractifs avec webxcas</title>
<script src="http://www-fourier.ujf-grenoble.fr/~parisse/giac.js"></script>
<script type="text/javascript">
var GIAC = {
caseval: Module.cwrap('_ZN4giac7casevalEPKc', 'string', ['string']),
entree: null, // we fill this in later
sortie: null, // we fill this in later
x: null,
donnee: function () {
if (!this.sortie) {
this.sortie = MathJax.Hub.getAllJax("sortie")[0]
} // find the math jax
var nb = this.caseval("rand(1,1,9)[0]");
var result = this.caseval("latex(expand((x+" + nb + ")^2))"); // evaluate the expression
result = result.substr(1, result.length - 2); // remove quotation marks
MathJax.Hub.Queue(["Text", this.sortie, result]); // typeset the result
x = nb;
},
verification: function () {
var test = 0
with(document.nombre) {
if (entree.value == x) {
alert("BRAVO !!")
test = 1
}
if (test == 0) {
alert("Non, c'est faux !")
}
}
}
};
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "left",
displayIndent: "1em",
tex2jax: {
inlineMath: [
["$", "$"],
["\\(", "\\)"]
]
},
});
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full"></script>
</head>
<body>
<form onsubmit="GIAC.donnee(); return false" name="nombre">
<div class="clearfix">
<input type="submit" value="Démarrer l'exercice">
<br>Compléter la factorisation de :
<div id="sortie" style="display:inline">$ $</div>
<br>
<p>$(x + $
<label>
<input name="entree" type="text" value="" size="1" />
</label>$)^2$</p>
<input type="button" onclick="GIAC.verification()" value="Verification">
<br>
<input type="button" onclick="window.close()" value="Fermer">
</div>
</form>
</body>
</html>