Logique
Boucles
Math
Texte
Listes
Données
Variables
Fonctions
Programmation
p5.js
Objets web
Propriétés
Formes
Tortue
Apparence
GeoGebra
var canvas, a, b, soln, btnSolutions, ligneSoln, ligneA, ligneB; /** * Fonction exécutée une fois, au départ */ function actions_initiales() { document.body.style.paddingLeft="30px"; //noCanvas(); noLoop(); createElement("h1",(String('Résoudre ') + String(codeMath('ax+b=0')))); createSpan('a = '); ligneA=createInput(''); createSpan("<br>"); createSpan('b = '); ligneB=createInput(''); createSpan("<br>"); createSpan("<br>"); btnSolutions=createButton('Résoudre'); siClicPrudent("btnSolutions",btnSolutions,"solution",solution); ligneSoln=createP(''); refreshMathJax();} /** * Fonction exécutée périodiq */ function actions_en_boucle() { } /** * Décrire cette fonction… */ function solution() { a = valeurPrudent("ligneA",ligneA); b = valeurPrudent("ligneB",ligneB); if (a == 0) { a = 0; } if (b == 0) { b = 0; } fixeContenuPrudent("ligneSoln",ligneSoln,''); coeurSolution(); refreshMathJax();} /** * Décrire cette fonction… */ function coeurSolution() { if (!estNombre(a)) { fixeContenuPrudent("ligneSoln",ligneSoln,'a doit être un nombre'); return ; } if (!estNombre(b)) { fixeContenuPrudent("ligneSoln",ligneSoln,'b doit être un nombre'); return ; } if (a == 0 && b == 0) { fixeContenuPrudent("ligneSoln",ligneSoln,'Tout nombre est solution de l\'équation'); return ; } if (a == 0 && b != 0) { fixeContenuPrudent("ligneSoln",ligneSoln,'Il n\'y a pas de solution'); return ; } fixeContenuPrudent("ligneSoln",ligneSoln,(String('Sotution unique : ') + String(codeMath((substitution('x=-b/a=-(@2)/(@1)~~@3',[a, b, -(b / a)])))))); }