Logique
Boucles
Math
Texte
Listes
Données
Variables
Fonctions
Programmation
p5.js
Objets web
Propriétés
Formes
Tortue
Apparence
GeoGebra
var canevas, tableau, gauche, droite, n, x, reponse, calculPI, nbDecPi, i; /** * Fonction exécutée une fois, au départ */ function actions_initiales() { document.body.style.paddingLeft="30px"; createElement("h1",'Calcul d\'une valeur approchée de π'); calculPI=createElement("h1",''); nbDecPi = 100; activerSAGE(); faireDelaiPrudent("premi_C3_A8re__C3_A9tape",premi_C3_A8re__C3_A9tape,0.5); } /** * Fonction exécutée périodiquement, de façon répétée */ function actions_en_boucle() { } /** * Décrire cette fonction… */ function premi_C3_A8re__C3_A9tape() { try { questionSAGE(('(16*atan(1/5)-4*atan(1/239)).n(digits=@)'.replace(new RegExp('@',"g"),nbDecPi)),obtenir_premi_C3_A8re_r_C3_A9ponse); } catch(erreur) { faireDelaiPrudent("premi_C3_A8re__C3_A9tape",premi_C3_A8re__C3_A9tape,0.1); }; } /** * Décrire cette fonction… */ function obtenir_premi_C3_A8re_r_C3_A9ponse(reponse) { fixeContenuPrudent("calculPI",calculPI,reponse); createElement("h1",'Factorisation de certains polynomes'); n = 1; gauche = ['Polynome']; droite = ['Factorisation']; tableau=creerAffichageListes([gauche, droite],1000,"PIXELS","INACTIVEE",500,24); prochaine__C3_A9tape(); } /** * Décrire cette fonction… */ function prochaine__C3_A9tape() { try { questionSAGE(('(x^@-1).factor()'.replace(new RegExp('@',"g"),n)),obtenir_r_C3_A9ponse); } catch(erreur) { faireDelaiPrudent("prochaine__C3_A9tape",prochaine__C3_A9tape,0.1); }; } /** * Décrire cette fonction… */ function obtenir_r_C3_A9ponse(reponse) { gauche.push(('x^n-1'.replace(new RegExp('n',"g"),n))); droite.push(reponse); afficherListes([gauche, droite],tableau); n = n + 1; if (n <= 30) { prochaine__C3_A9tape(); } else { for (i = 1; i <= 30; i += abs(1)) { gauche[i] = (codeMath((gauche[i]))); droite[i] = (codeMath((droite[i]))); } afficherListes([gauche, droite],tableau); refreshMathJax();} }