File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/beta2N31-5-ZNooilik.js.map
{"version":3,"file":"beta2N31-5-ZNooilik.js","sources":["../../src/exercices/2e/beta2N31-5.js"],"sourcesContent":["import { combinaisonListes } from '../../lib/outils/arrayOutils'\nimport { egalOuApprox } from '../../lib/outils/ecritures'\nimport { arrondi } from '../../lib/outils/nombres'\nimport { decimalToScientifique, texNombre } from '../../lib/outils/texNombre'\nimport Exercice from '../Exercice'\nimport { calculANePlusJamaisUtiliser, listeQuestionsToContenu, randint } from '../../modules/outils.js'\nimport { ajouteChampTexteMathLive } from '../../lib/interactif/questionMathLive.js'\nimport { context } from '../../modules/context.js'\nimport { round } from 'mathjs'\nimport { setReponse } from '../../lib/interactif/gestionInteractif.js'\n\nexport const uuid = 'a1d0b'\nexport const titre = 'Calculate with numbers in scientific notation'\nexport const interactifReady = true\nexport const interactifType = 'mathLive'\n// Les exports suivants sont optionnels mais au moins la date de publication semble essentielle\nexport const dateDePublication = '18/02/2022' // La date de publication initiale au format 'jj/mm/aaaa' pour affichage temporaire d'un tag\n// export const dateDeModifImportante = '24/10/2021' // Une date de modification importante au format 'jj/mm/aaaa' pour affichage temporaire d'un tag\n/**\n * Calculer avec des nombres en notation scientifique\n * @author Matthieu Devillers\n * 2N31-5\n */\nexport default class CalculerAvecEcritureScientifique extends Exercice {\n constructor () {\n super()\n this.titre = titre\n this.interactifReady = interactifReady\n this.interactifType = interactifType\n this.correctionDetailleeDisponible = true\n context.isHtml ? (this.spacingCorr = 3) : (this.spacingCorr = 2)\n if (!context.isHtml) {\n this.correctionDetaillee = false\n }\n this.consigne = 'Calculate, detailing the steps, then express the result in scientific form. <br>'\n this.consigne += 'If necessary, we will round the mantissa to the nearest hundredth.'\n this.nbCols = 2\n this.nbColsCorr = 2\n this.spacing = 1.5\n this.spacingCorr = 1.5\n this.nbQuestions = 3\n this.sup = 1\n this.besoinFormulaireNumerique = ['Difficulty level', 4, '1: Product\\n 2: Quotient\\n 3: Product quotient\\n 4: Combination of previous cases']\n }\n\n nouvelleVersion () {\n this.sup = parseInt(this.sup)\n this.listeQuestions = [] // Liste de questions\n this.listeCorrections = [] // Liste de questions corrigées\n let typesDeQuestionsDisponibles = []\n if (this.sup === 1) {\n typesDeQuestionsDisponibles = [1] // Produit\n } else if (this.sup === 2) {\n typesDeQuestionsDisponibles = [2] // Quotient\n } else if (this.sup === 3) {\n typesDeQuestionsDisponibles = [3] // Quotient de produits\n } else {\n typesDeQuestionsDisponibles = [1, 2, 3]\n } // Mélange des cas précédents\n const listeTypeDeQuestions = combinaisonListes(typesDeQuestionsDisponibles, this.nbQuestions)\n for (let i = 0, texte, texteCorr, reponse, somme, cpt = 0, a = [], b = [], c = [], prod = [], n, typesDeQuestions; i < this.nbQuestions && cpt < 50;) {\n typesDeQuestions = listeTypeDeQuestions[i]\n n = 0\n while (n < 4) {\n c[n] = randint(-30, 30, [-1, 0, 1]) // initialise les exposants entiers relatifs\n b[n] = randint(11, 99) / 10 // initialise les mantisses entières ou avec un chiffre des dixièmes non nul.\n a[n] = randint(1, 9) + randint(0, 9) / 10 + randint(1, 9) / 10 / 10 // initialise les mantises avec chiffre des centièmes non nul\n if (randint(1, 2) === 1) {\n [a[n], b[n]] = [b[n], a[n]]\n }\n // prod[n] does not contain the product but the table from decimalToScientifique.\n // this avoids having to call it up every time we need the mantissa or its exponent.\n prod[n] = decimalToScientifique(arrondi(a[n] * b[n], 3))\n n++\n }\n texte = ''\n switch (typesDeQuestions) {\n case 1:\n texte = `$ ${texNombre(a[0])} \\\\times 10^{${texNombre(c[0])}} \\\\times ${texNombre(b[0])} \\\\times 10^{${texNombre(c[1])}} $\\n` // a.10^n x b.10^m = ?\n somme = c[1] + c[0]\n if (this.correctionDetaillee) {\n texteCorr = `<br>$\\\\begin{aligned}${texNombre(a[0])} \\\\times 10^{${texNombre(c[0])}} \\\\times ${texNombre(b[0])} \\\\times 10^{${texNombre(c[1])}} &= \\\\left ( ${texNombre(a[0])} \\\\times ${texNombre(b[0])} \\\\right ) \\\\times \\\\left ( 10^{${texNombre(c[1])}} \\\\times 10^{${texNombre(c[0])}} \\\\right )\\\\\\\\\\n`\n texteCorr += `&= ${texNombre(a[0] * b[0], 3)} \\\\times 10^{${texNombre(somme)}}\\\\\\\\n`\n if (prod[0][1] !== 0) { // On ajoute ces lignes seulement si l'exposant du produit est différent de zéro\n texteCorr += `&= ${texNombre(prod[0][0])} \\\\times 10^{${prod[0][1]}} \\\\times 10^{${somme}}\\\\\\\\n`\n texteCorr += `&= ${texNombre(prod[0][0])} \\\\times 10^{${prod[0][1] + somme}}\\\\\\\\n`\n }\n // The following line is a conditional concatenation: if there is no rounding to be done we finish the calculation otherwise we add a line for the approximation\n texteCorr += egalOuApprox(prod[0][0], 2) === '=' ? '\\\\\\\\\\n\\\\end{aligned}$<br>' : `&\\\\approx ${texNombre(round(prod[0][0], 2))} \\\\times 10^{${prod[0][1] + somme}}\\\\\\\\\\n\\\\end{aligned}$<br>(with the mantissa rounded to the nearest hundredth) <br>`\n } else {\n texteCorr = `$ ${texNombre(a[0])} \\\\times 10^{${texNombre(c[0])}} \\\\times ${texNombre(b[0])} \\\\times 10^{${texNombre(c[1])}} ${egalOuApprox()} ${texNombre(round(decimalToScientifique(prod[0])[0], 2))} \\\\times 10^{${calculANePlusJamaisUtiliser(decimalToScientifique(prod[0])[1] + somme)}} $ (with the mantissa rounded to the nearest hundredth) <br>`\n }\n reponse = `${texNombre(prod[0][0], 2)}\\\\times 10^{${prod[0][1] + somme}}`\n\n break\n case 2:\n texte = `Text2 ${a[0]}` // b>1\n if (this.correctionDetaillee) {\n texteCorr += 'Detailed Correction 2'\n } else {\n texteCorr += 'CorrTest2'\n }\n reponse = 'Test 2'\n break\n case 3:\n texte = `Text3 ${b[0]}` // b<-1\n if (this.correctionDetaillee) {\n texteCorr += 'Detailed fix 3'\n } else {\n texteCorr = texte + 'CorrTest3'\n }\n reponse = 'test 3'\n break\n }\n texte += ajouteChampTexteMathLive(this, i)\n setReponse(this, i, reponse, { formatInteractif: 'writingScientist' })\n // JC: setResponse(this, i, response, {Interactive format: 'Scientific Writing'})\n // JC: If we do not specify the Interactive format, then by default, it is 'calculation', and then, response must contain a number, not a character string.\n if (this.questionJamaisPosee(i, reponse, somme, a, b, c, prod)) {\n // If the question has never been asked, we create another one\n this.listeQuestions.push(texte)\n this.listeCorrections.push(texteCorr)\n i++\n }\n cpt++\n }\n listeQuestionsToContenu(this)\n }\n}\n"],"names":["uuid","titre","interactifReady","interactifType","dateDePublication","CalculerAvecEcritureScientifique","Exercice","context","typesDeQuestionsDisponibles","listeTypeDeQuestions","combinaisonListes","i","texte","texteCorr","reponse","somme","cpt","a","b","c","prod","n","typesDeQuestions","randint","decimalToScientifique","arrondi","texNombre","egalOuApprox","round","calculANePlusJamaisUtiliser","ajouteChampTexteMathLive","setReponse","listeQuestionsToContenu"],"mappings":"qKAWY,MAACA,EAAO,QACPC,EAAQ,gDACRC,EAAkB,GAClBC,EAAiB,WAEjBC,EAAoB,aAOlB,MAAMC,UAAyCC,CAAS,CACrE,aAAe,CACb,MAAO,EACP,KAAK,MAAQL,EACb,KAAK,gBAAkBC,EACvB,KAAK,eAAiBC,EACtB,KAAK,8BAAgC,GACrCI,EAAQ,OAAU,KAAK,YAAc,EAAM,KAAK,YAAc,EACzDA,EAAQ,SACX,KAAK,oBAAsB,IAE7B,KAAK,SAAW,mFAChB,KAAK,UAAY,qEACjB,KAAK,OAAS,EACd,KAAK,WAAa,EAClB,KAAK,QAAU,IACf,KAAK,YAAc,IACnB,KAAK,YAAc,EACnB,KAAK,IAAM,EACX,KAAK,0BAA4B,CAAC,mBAAoB,EAAG;AAAA;AAAA;AAAA,kCAAmF,CAC7I,CAED,iBAAmB,CACjB,KAAK,IAAM,SAAS,KAAK,GAAG,EAC5B,KAAK,eAAiB,CAAE,EACxB,KAAK,iBAAmB,CAAE,EAC1B,IAAIC,EAA8B,CAAE,EAChC,KAAK,MAAQ,EACfA,EAA8B,CAAC,CAAC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