HEX
Server: Apache
System: Linux vps.mmtprep.com 4.18.0-477.21.1.el8_8.x86_64 #1 SMP Thu Aug 10 13:51:50 EDT 2023 x86_64
User: mmtprep (1001)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/4L20-0-eBO9Bz8d.js.map
{"version":3,"file":"4L20-0-eBO9Bz8d.js","sources":["../../src/exercices/4e/4L20-0.js"],"sourcesContent":["import { combinaisonListes } from '../../lib/outils/arrayOutils'\nimport { miseEnEvidence } from '../../lib/outils/embellissements'\nimport { deprecatedTexFraction } from '../../lib/outils/deprecatedFractions.js'\nimport { ecritureAlgebrique, ecritureParentheseSiNegatif, rienSi1 } from '../../lib/outils/ecritures'\nimport { abs, signe } from '../../lib/outils/nombres'\nimport { sp } from '../../lib/outils/outilString.js'\nimport Exercice from '../deprecatedExercice.js'\nimport { context } from '../../modules/context.js'\nimport { calculANePlusJamaisUtiliser, listeQuestionsToContenu, randint } from '../../modules/outils.js'\nimport { ajouteChampTexteMathLive } from '../../lib/interactif/questionMathLive.js'\nimport { setReponse } from '../../lib/interactif/gestionInteractif.js'\n\nexport const interactifReady = true\nexport const interactifType = 'mathLive'\nexport const amcReady = true\nexport const amcType = 'AMCNum'\n\nexport const titre = 'Solve a first degree equation with integer solutions'\n\n/**\n * Équation du premier degré\n * * Type 1 : x+a=b ou ax=b\n * * Type 2 : ax+b=c\n * * Type 3 : ax+b=cx+d\n * * Tous les types\n * @author Rémi Angot\n * Modifications de 4L20 pour n'avoir que des solutions entières : Jean-Claude Lhote\n * 4L20-0\n */\nexport const uuid = '515b0'\nexport const ref = '4L20-0'\nexport default function ExerciceEquationASolutionEntiere () {\n  Exercice.call(this) // Héritage de la classe Exercice()\n  this.titre = titre\n  this.consigne = 'Solve the following equations.'\n  this.spacing = 2\n  context.isHtml ? (this.spacingCorr = 3) : (this.spacingCorr = 2)\n  this.correctionDetailleeDisponible = true\n  if (!context.isHtml) {\n    this.correctionDetaillee = false\n  } else {\n    this.correctionDetaillee = true\n  }\n  this.sup = true // Avec des nombres relatifs\n  this.sup2 = 4 // Choix du type d'équation\n  this.nbQuestions = 6\n\n  this.nouvelleVersion = function () {\n    this.listeQuestions = [] // Liste de questions\n    this.listeCorrections = [] // Liste de questions corrigées\n    this.autoCorrection = []\n    let listeTypeDeQuestions\n    switch (this.sup2.toString()) {\n      case '1':\n        listeTypeDeQuestions = ['ax=b', 'x+b=c']\n        break\n      case '2':\n        listeTypeDeQuestions = ['ax+b=c']\n        break\n      case '3':\n        listeTypeDeQuestions = ['ax+b=cx+d']\n        break\n      default:\n        listeTypeDeQuestions = [\n          'ax+b=0',\n          'ax+b=c',\n          'ax=b',\n          'x+b=c',\n          'ax+b=cx+d'\n        ]\n        break\n    }\n    listeTypeDeQuestions = combinaisonListes(\n      listeTypeDeQuestions,\n      this.nbQuestions\n    )\n    for (let i = 0, a, b, c, d, reponse, texte, texteCorr, cpt = 0; i < this.nbQuestions && cpt < 50;) {\n      // We limit the number of tests to search for new values\n      switch (listeTypeDeQuestions[i]) {\n        case 'ax+b=0':\n        case 'ax+b=c':\n          do {\n            if (listeTypeDeQuestions[i] === 'ax+b=0') {\n              c = 0\n            } else {\n              c = randint(-9, 9, [0])\n            }\n            reponse = randint(-5, 5, [0, -1, 1])\n            a = randint(-5, 5, [-1, 0, 1])\n            if (!this.sup) {\n              reponse = Math.abs(reponse)\n              a = Math.abs(a)\n              c = Math.abs(c)\n            }\n            b = c - a * reponse // b peut être négatif, ça sera une équation du type x-b=c\n            texte = `$${a}x${ecritureAlgebrique(b)}=${c}$`\n            texteCorr = texte + '<br>'\n            if (this.correctionDetaillee) {\n              if (b > 0) {\n                texteCorr += `We subtract $${b}$ from both sides.<br>`\n              } else {\n                texteCorr += `We add $${-1 * b}$ to both sides.<br>`\n              }\n            }\n            texteCorr += `$${a}x${ecritureAlgebrique(b)}${miseEnEvidence(ecritureAlgebrique(-1 * b))}=${c}${miseEnEvidence(ecritureAlgebrique(-1 * b))}$<br>`\n            texteCorr += `$${a}x=${c - b}$<br>`\n            if (this.correctionDetaillee) {\n              texteCorr += `We divide both sides by $${a}$.<br>`\n            }\n            texteCorr += `$${a}x${miseEnEvidence('\\\\div' + ecritureParentheseSiNegatif(a))}=${c - b + miseEnEvidence('\\\\div' + ecritureParentheseSiNegatif(a))}$<br>`\n            texteCorr += `$x=${deprecatedTexFraction(c - b, a)}=${reponse}$`\n            texteCorr += `<br> The solution is $${reponse}$.`\n          } while (b === 0)\n          break\n        case 'x+b=c':\n          b = randint(-9, 9, [0]) // b peut être négatif, ça sera une équation du type x-b=c\n          c = randint(-16, 15, 0)\n          if (!this.sup) {\n            c = Math.abs(c)\n          }\n          reponse = c - b\n          texte = `$x${ecritureAlgebrique(b)}=${c}$`\n          texteCorr = texte + '<br>'\n          if (this.correctionDetaillee) {\n            if (b > 0) {\n              texteCorr += `We subtract $${b}$ from both sides.<br>`\n            } else {\n              texteCorr += `We add $${-1 * b}$ to both sides.<br>`\n            }\n          }\n          texteCorr += `$x${ecritureAlgebrique(b)}${miseEnEvidence(ecritureAlgebrique(-1 * b))}=${c}${miseEnEvidence(ecritureAlgebrique(-1 * b))}$<br>`\n          texteCorr += `$x=${reponse}$`\n          texteCorr += `<br> The solution is $${reponse}$.`\n          break\n        case 'ax=b':\n          if (this.sup) {\n            a = randint(-9, 9, [0, -1, 1]) // b peut être négatif, ça sera une équation du type x-b=c\n            reponse = randint(-9, 9, [-1, 0, 1])\n          } else {\n            a = randint(2, 15)\n            reponse = randint(2, 9)\n          }\n          b = a * reponse\n          texte = `$${a}x=${b}$`\n          texteCorr = texte + '<br>'\n          if (this.correctionDetaillee) {\n            texteCorr += `We divide both sides by $${a}$.<br>`\n          }\n          texteCorr += `$${a}x${miseEnEvidence('\\\\div' + ecritureParentheseSiNegatif(a))}=${b + miseEnEvidence('\\\\div' + ecritureParentheseSiNegatif(a))}$<br>`\n          texteCorr += `$x=${deprecatedTexFraction(b, a)}=${reponse}$`\n          texteCorr += `<br> The solution is $${reponse}$.`\n          break\n        case 'ax+b=cx+d':\n          d = randint(-15, 15, 0)\n          c = randint(-5, 5, [-1, 0, 1])\n          if (!this.sup) {\n            c = Math.abs(c)\n            a = randint(2, 5) + c\n            reponse = Math.abs(randint(-9, 9, [0, -1, 1], calculANePlusJamaisUtiliser(-d / (c - a))))\n          } else {\n            a = randint(-5, 5, [-c, -c + 1, -c - 1, 0]) + c\n            reponse = randint(-9, 9, [0, -1, 1], calculANePlusJamaisUtiliser(-d / (c - a)))\n          }\n          b = (c - a) * reponse + d\n          texte = `$${rienSi1(a)}x${ecritureAlgebrique(b)}=${rienSi1(c)}x${ecritureAlgebrique(d)}$`\n          texteCorr = texte + '<br>'\n          if (this.correctionDetaillee) {\n            if (c > 0) {\n              texteCorr += `We subtract $${rienSi1(c)}x$ from both sides.<br>`\n            } else {\n              texteCorr += `We add $${rienSi1(-1 * c)}x$ to both sides.<br>`\n            }\n          }\n          texteCorr += `$${rienSi1(a)}x${ecritureAlgebrique(b)}${miseEnEvidence(signe(-1 * c) + rienSi1(abs(c)) + 'x')}=${c}x${ecritureAlgebrique(d)}${miseEnEvidence(signe(-1 * c) + rienSi1(abs(c)) + 'x')}$<br>`\n          texteCorr += `$${rienSi1(a - c)}x${ecritureAlgebrique(b)}=${d}$<br>`\n          if (this.correctionDetaillee) {\n            if (b > 0) {\n              texteCorr += `We subtract $${b}$ from both sides.<br>`\n            } else {\n              texteCorr += `We add $${-1 * b}$ to both sides.<br>`\n            }\n          }\n          texteCorr += `$${rienSi1(a - c)}x${ecritureAlgebrique(b)}${miseEnEvidence(ecritureAlgebrique(-1 * b))}=${d}${miseEnEvidence(ecritureAlgebrique(-1 * b))}$<br>`\n          texteCorr += `$${rienSi1(a - c)}x=${d - b}$<br>`\n\n          if (this.correctionDetaillee) {\n            texteCorr += `We divide both sides by $${a - c}$.<br>`\n          }\n          texteCorr += `$${rienSi1(a - c)}x${miseEnEvidence('\\\\div' + ecritureParentheseSiNegatif(a - c))}=${d - b + miseEnEvidence('\\\\div' + ecritureParentheseSiNegatif(a - c))}$<br>`\n          texteCorr += `$x=${deprecatedTexFraction(d - b, a - c)}=${reponse}$`\n          texteCorr += `<br> The solution is $${reponse}$.`\n          break\n      }\n      texte += ajouteChampTexteMathLive(this, i, 'largeur10 inline', { texteAvant: sp(10) + '<br>The solution is $x=$' })\n      this.sup ? setReponse(this, i, reponse, { signe: true }) : setReponse(this, i, reponse, { signe: false })\n      if (this.questionJamaisPosee(i, a, b, c)) {\n        // If the question has never been asked, we create another one\n        this.listeQuestions.push(texte) // replace(/1x/g,'x')); //remplace 1x par x\n        this.listeCorrections.push(texteCorr) // .replace(/1x/g,'x')); //remplace 1x par x\n        i++\n      }\n      cpt++\n    }\n    listeQuestionsToContenu(this)\n    if (!context.isHtml) {\n      this.canEnonce = 'Solve the equation' + this.listeQuestions[0] + '.'\n      this.correction = this.listeCorrections[0]\n      this.canReponseACompleter = ''\n    }\n  }\n  this.besoinFormulaireCaseACocher = ['With relative numbers']\n  this.besoinFormulaire2Numerique = [\n    'Type of equations',\n    4,\n    '1: ax=b or x+a=b or x-a=b\\n2: ax+b=c\\n3: ax+b=cx+d\\n4: Mix'\n  ]\n}\n"],"names":["interactifReady","interactifType","amcReady","amcType","titre","uuid","ref","ExerciceEquationASolutionEntiere","Exercice","context","listeTypeDeQuestions","combinaisonListes","i","a","b","c","d","reponse","texte","texteCorr","cpt","randint","ecritureAlgebrique","miseEnEvidence","ecritureParentheseSiNegatif","deprecatedTexFraction","calculANePlusJamaisUtiliser","rienSi1","signe","abs","ajouteChampTexteMathLive","sp","setReponse","listeQuestionsToContenu"],"mappings":"8LAYY,MAACA,EAAkB,GAClBC,EAAiB,WACjBC,EAAW,GACXC,EAAU,SAEVC,EAAQ,uDAYRC,EAAO,QACPC,EAAM,SACJ,SAASC,GAAoC,CAC1DC,EAAS,KAAK,IAAI,EAClB,KAAK,MAAQJ,EACb,KAAK,SAAW,iCAChB,KAAK,QAAU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