File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/4P10-1-rkRlUeit.js.map
{"version":3,"file":"4P10-1-rkRlUeit.js","sources":["../../src/exercices/4e/4P10-1.js"],"sourcesContent":["import { courbe } from '../../lib/2d/courbes.js'\nimport { point } from '../../lib/2d/points.js'\nimport { repere } from '../../lib/2d/reperes.js'\nimport { segment } from '../../lib/2d/segmentsVecteurs.js'\nimport { choice, combinaisonListesSansChangerOrdre } from '../../lib/outils/arrayOutils'\nimport { texteEnCouleur } from '../../lib/outils/embellissements'\nimport { numAlpha } from '../../lib/outils/outilString.js'\nimport { prenom } from '../../lib/outils/Personne'\nimport { premierMultipleSuperieur } from '../../lib/outils/primalite'\nimport { texPrix, texteGras } from '../../lib/format/style'\nimport Exercice from '../deprecatedExercice.js'\nimport { mathalea2d } from '../../modules/2dGeneralites.js'\nimport { context } from '../../modules/context.js'\nimport { listeQuestionsToContenu, randint, calculANePlusJamaisUtiliser } from '../../modules/outils.js'\nexport const titre = 'Solve a proportionality problem using a graph'\n\n/**\n * fork de 4P10-1 par Jean-Claude Lhote\n * @author Sébastien LOZANO // je reprécise car j'avais disparu :D\n */\n\nexport const uuid = 'c668a'\nexport const ref = '4P10-1'\nexport default function GraphiquesEtProportionnalite2 () {\n Exercice.call(this) // Héritage de la classe Exercice()\n this.debug = false\n if (this.debug) {\n this.nbQuestions = 2\n } else {\n this.nbQuestions = 1\n }\n\n this.titre = titre\n this.consigne = ''\n this.spacingCorr = 2\n\n this.nbCols = 1\n this.nbColsCorr = 1\n // this.nbQuestionsModifiable = false;\n context.isHtml ? this.spacing = 2 : this.spacing = 1\n // context.isHtml? this.spacingCorr = 3 : this.spacingCorr = 2;\n\n let typesDeQuestionsDisponibles\n\n this.nouvelleVersion = function () {\n if (this.debug) {\n typesDeQuestionsDisponibles = [1]\n } else {\n typesDeQuestionsDisponibles = [1]\n }\n\n this.listeQuestions = [] // Liste de questions\n this.listeCorrections = [] // Liste de questions corrigées\n\n // AvailableQuestionTypes=[1];\n\n // let listTypeOfQuestions = combinationLists(availablequestiontypes, this.nbQuestions) // All types of questions are asked but the order differs for each \"cycle\"\n const listeTypeDeQuestions = combinaisonListesSansChangerOrdre(typesDeQuestionsDisponibles, this.nbQuestions) // Tous les types de questions sont posées --> à remettre comme ci-dessus\n\n for (let i = 0, texte, texteCorr, cpt = 0; i < this.nbQuestions && cpt < 50;) {\n // we anticipate a bit of randomness for the unit prices\n const prixUnitaireOranges = choice([1.2, 1.4, 1.6, 1.8])\n const prixUnitaireBaguettes = choice([0.6, 0.8, 1.2])\n // we provide a table with situations\n const situations = [\n { lieu: 'the grocery store', prenom: prenom(), articles: 'oranges', art_articles: 'oranges', prix_unitaire: prixUnitaireOranges, qte: 'weight', qte_max: 10, qte2: 3, unite: 'kg of', legendeX: 'weight in kg', legendeY: 'price in €', fig: {}, figureCorr: {} },\n { lieu: 'the bakery', prenom: prenom(), articles: 'chopsticks', art_articles: 'of chopsticks', prix_unitaire: prixUnitaireBaguettes, qte: 'number', qte_max: 10, qte2: 3, unite: '', legendeX: 'quantity', legendeY: 'price in €', fig: {}, figureCorr: {} }\n ]\n // we choose one\n const situation = situations[randint(0, situations.length - 1)]\n let r\n const xscale = 1\n const yscale = choice([1, 2, 5])\n // to randomize the step on the price axis a little\n let stepAxeSecondaire\n if (yscale === 1) stepAxeSecondaire = choice([0.5, 0.2, 0.25])\n else stepAxeSecondaire = choice([0.5, 0.2, 0.25])\n // we end the calls\n const mesAppels = [\n r = repere({\n xMin: 0,\n yMin: 0,\n yMax: premierMultipleSuperieur(yscale, (situation.qte_max + 1) * situation.prix_unitaire + yscale),\n xMax: situation.qte_max + 1,\n xUnite: 1,\n yUnite: 1 / yscale,\n yThickDistance: yscale,\n xLegende: situation.legendeX,\n yLegende: situation.legendeY,\n grille: true,\n grilleOpacite: 0.5,\n grilleXDistance: 1,\n grilleYDistance: yscale,\n grilleXMin: 0,\n grilleYMin: 0,\n grilleSecondaire: true,\n grilleSecondaireXDistance: 0.2,\n grilleSecondaireYDistance: yscale / 5,\n grilleSecondaireXMin: 0,\n grilleSecondaireYMin: 0,\n grilleSecondaireXMax: situation.qte_max + 1,\n grilleSecondaireYMax: premierMultipleSuperieur(yscale, (situation.qte_max + 1) * situation.prix_unitaire + yscale),\n yLegendePosition: [0, premierMultipleSuperieur(yscale, (situation.qte_max + 1) * situation.prix_unitaire + yscale) / yscale + 0.5],\n xLegendePosition: [situation.qte_max + 1 + 0.2, 0]\n })\n ]\n const f = x => situation.prix_unitaire * x\n mesAppels.push(r, courbe(f, { repere: r, xMin: 0, xMax: situation.qte_max + 1, color: 'black', epaisseur: 1.5 }))\n // we prepare the figure object\n const fig = mathalea2d(\n {\n xmin: -xscale,\n ymin: -1,\n xmax: situation.qte_max / xscale + 3,\n ymax: ((situation.qte_max + 1) * situation.prix_unitaire + yscale) / yscale + 2,\n pixelsParCm: 30\n },\n mesAppels\n )\n situation.fig = fig\n\n // we prepare the additional calls for the correction\n const mesAppelsCorr = mesAppels\n const A = point(situation.qte_max, 0)\n const B = point(situation.qte_max, calculANePlusJamaisUtiliser(situation.qte_max * situation.prix_unitaire / yscale))\n const s1 = segment(A, B, 'red')\n s1.epaisseur = 2\n s1.pointilles = 5\n s1.styleExtremites = '->'\n const C = point(0, calculANePlusJamaisUtiliser(situation.qte_max * situation.prix_unitaire / yscale))\n const s2 = segment(B, C, 'red')\n s2.epaisseur = 2\n s2.pointilles = 5\n s2.styleExtremites = '->'\n\n const D = point(situation.qte2, 0)\n const E = point(situation.qte2, calculANePlusJamaisUtiliser(situation.qte2 * situation.prix_unitaire / yscale))\n const s3 = segment(D, E, 'blue')\n s3.epaisseur = 2\n s3.pointilles = 5\n s3.styleExtremites = '->'\n const F = point(0, calculANePlusJamaisUtiliser(situation.qte2 * situation.prix_unitaire / yscale))\n const s4 = segment(E, F, 'blue')\n s4.epaisseur = 2\n s4.pointilles = 5\n s4.styleExtremites = '->'\n\n // we add the calls for the correction\n mesAppelsCorr.push(\n s1,\n s2,\n s3,\n s4\n )\n\n // we prepare the figure correction object\n const figureCorr = mathalea2d(\n {\n xmin: -xscale,\n ymin: -1,\n xmax: situation.qte_max / xscale + 3,\n ymax: (situation.qte_max * situation.prix_unitaire + 4) / yscale + 1,\n pixelsParCm: 30\n },\n mesAppelsCorr\n )\n situation.figureCorr = figureCorr\n\n // a counter for sub-questions\n let k = 0\n let kCorr = 0\n\n const enonces = []\n enonces.push({\n enonce:\n `At ${situation.lieu}, ${situation.prenom} uses the chart below to indicate the price of its ${situation.articles}s as a function of ${situation.qte} ${situation.art_articles}.<br>${situation.fig}<br>${numAlpha(k++)} Justify that this is a proportionality situation using the chart.<br> ${numAlpha(k++)} What is the price of $${situation.qte_max}$ ${situation.unite} ${situation.articles}?<br> ${numAlpha(k++)} What is the price of $${situation.qte2}$ ${situation.unite} ${situation.articles}?`,\n correction: `${numAlpha(kCorr++)} This graph is a straight line which passes through the origin.<br> ${texteEnCouleur('It is therefore indeed the graph of a situation of proportionality.')}<br> ${numAlpha(kCorr++)} By reading graphically, using the red dotted lines of the graph below, ${texteEnCouleur(`${situation.qte_max} ${situation.unite} ${situation.articles} cost $\\\\$$${texPrix(calculANePlusJamaisUtiliser(situation.qte_max * situation.prix_unitaire))}.`)}<br> ${situation.figureCorr} <br> ${numAlpha(kCorr++)} For $${situation.qte2}$ ${situation.unite} ${situation.articles}, the graphical reading is less easy, we will detail two methods.<br><br> ${texteGras('First method by graphic reading:')}<br> It is necessary to take into account that each small square represents $\\\\$${texPrix(stepAxeSecondaire * yscale)}$ and use the blue dotted lines.<br><br> ${texteGras('Second method by calculating a fourth proportional:')}<br> $${situation.qte_max}$ ${situation.unite} ${situation.articles} costs $\\\\$${texPrix(calculANePlusJamaisUtiliser(situation.qte_max * situation.prix_unitaire))}$ so $${situation.qte2}$ ${situation.unite} ${situation.articles} costs: <br> $(\\\\$${texPrix(calculANePlusJamaisUtiliser(situation.qte_max * situation.prix_unitaire))}$ $\\\\div ${situation.qte_max}$ ${situation.articles} $)\\\\times (${situation.qte2}$ ${situation.articles}) $= \\\\$${texPrix(calculANePlusJamaisUtiliser(situation.qte2 * situation.prix_unitaire))}$ <br><br>${texteEnCouleur(`Regardless of the method used, ${situation.qte2} ${situation.unite} ${situation.articles} costs $\\\\$$${texPrix(calculANePlusJamaisUtiliser(situation.qte2 * situation.prix_unitaire)).replace('{.}', '.')}.`)}`\n })\n switch (listeTypeDeQuestions[i]) {\n case 1:\n texte = `${enonces[0].enonce}`\n if (this.debug) {\n texte += '<br>'\n texte += `<br> =====CORRECTION======<br>${enonces[0].correction}`\n texteCorr = ''\n } else {\n texteCorr = `${enonces[0].correction}`\n }\n break\n }\n\n if (this.listeQuestions.indexOf(texte) === -1) { // Si la question n'a jamais été posée, on en créé une autre\n this.listeQuestions.push(texte)\n this.listeCorrections.push(texteCorr)\n i++\n }\n cpt++\n }\n listeQuestionsToContenu(this)\n }\n}\n"],"names":["titre","uuid","ref","GraphiquesEtProportionnalite2","Exercice","context","typesDeQuestionsDisponibles","listeTypeDeQuestions","combinaisonListesSansChangerOrdre","i","texte","texteCorr","cpt","prixUnitaireOranges","choice","prixUnitaireBaguettes","situations","prenom","situation","randint","r","xscale","yscale","stepAxeSecondaire","mesAppels","repere","premierMultipleSuperieur","f","x","courbe","fig","mathalea2d","mesAppelsCorr","A","point","B","calculANePlusJamaisUtiliser","s1","segment","C","s2","D","E","s3","s4","figureCorr","k","kCorr","enonces","numAlpha","texteEnCouleur","texPrix","texteGras","listeQuestionsToContenu"],"mappings":"+SAcY,MAACA,EAAQ,gDAORC,GAAO,QACPC,GAAM,SACJ,SAASC,IAAiC,CACvDC,EAAS,KAAK,IAAI,EAClB,KAAK,MAAQ,GACT,KAAK,MACP,KAAK,YAAc,EAEnB,KAAK,YAAc,EAGrB,KAAK,MAAQJ,EACb,KAAK,SAAW,GAChB,KAAK,YAAc,EAEnB,KAAK,OAAS,EACd,KAAK,WAAa,EAElBK,EAAQ,OAAS,KAAK,QAAU,EAAI,KAAK,QAAU,EAGnD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