lundi 4 octobre 2010

Tutoriel Javascript 7: Intégrale de Riemann





Sorry, the GeoGebra Applet could not be started. Please make sure that Java 1.5 (or later) is installed and active in your browser (Click here to install Java now)



X Min = X Max = Y Min = Y Max =


f(x)=


f(x)=


Paramètres de la somme: a = b = Nombre de rectangles n =




Source : http://webspace.ship.edu/msrenault/tutorial/Tutorial%207%20-%20Incorporating%20JavaScript.html

Code:


<form name="MyForm">
 Min X = <input name="LowXField" size="5" value="-1" type="text">
 Max X = <input name="HighXField" size="5" value="9" type="text">
 Min Y = <input name="LowYField" size="5" value="-2" type="text">
 Max Y = <input name="HighYField" size="5" value="5" type="text">
 <input value="Afficher la fenêtre" onclick="setView()" type="button">
<p>
 
 f(x) = <input name="FunctionField" size="30" value=" "> 
 <input value="Graphique" onclick="setFunction()" type="button">  
 <p>
 
 f(x) = <select name="ExampleSelect"> 
  <option value="">Exemples</option>
  <option value="sin(2 x) - 1 / 10 x^2 + 3">sin(2 x) - 1 / 10 x^2 + 3</option>
  <option value="2 + cos(x/2)">2 + cos(x/2)</option>
<option value="x^2 / 20">x^2 / 20</option>
  <option value="ln(x)">ln(x)</option>
  <option value="sqrt(x)">sqrt(x)</option>
  <option value="cbrt(x)">cbrt(x)</option>
  </select>
 <input value="Charger l'exemple" onclick="exampleLoader()" type="button"> 
 <p>
Paramètres de la somme: a = <input name="A" size="5" value="1" type="text">
     b = <input name="B" size="5" value="7" type="text">
    Nombre de rectangles n = <input name="N" size="5" value="12" type="text">
 <input value="Valider" onclick="setRiemann()" type="button">

</form>


<script type="text/javascript">
 function setView() {
  var applet = document.ggbApplet;
  var LowX = document.MyForm.LowXField.value;
  var HighX = document.MyForm.HighXField.value;
  var LowY = document.MyForm.LowYField.value;
  var HighY = document.MyForm.HighYField.value;

  applet.setCoordSystem(LowX, HighX, LowY, HighY);
 }

 function setFunction() {
  var applet = document.ggbApplet;
  var func = "f(x) = " + document.MyForm.FunctionField.value;
  applet.evalCommand(func);
 }

 function exampleLoader() {
  var func = document.MyForm.ExampleSelect.value;
  if (func != "") {
   document.MyForm.FunctionField.value = func;
   setFunction();
  }
 }
 
 function setRiemann() {
  var applet = document.ggbApplet;
  var a = document.MyForm.A.value
  var b = document.MyForm.B.value
  var n = document.MyForm.N.value
  
  applet.evalCommand("a = " + a);
  applet.evalCommand("b = " + b);
  applet.evalCommand("n = " + n);
 }
 
</script>

Aucun commentaire:

Enregistrer un commentaire