diff --git a/Questions/BTS 2 - DST 2 - Réponses.tex b/Questions/BTS 2 - DST 2 - Réponses.tex new file mode 100644 index 0000000..22ce965 --- /dev/null +++ b/Questions/BTS 2 - DST 2 - Réponses.tex @@ -0,0 +1,90 @@ ++1 -1, +1 -1, +1 -1, +1 -1, +2 -1, +2 -1, +2 -1, +3 -1, +3 -1, +3 -1, +3 -1 +ABBACBBBCDB +BABABCBDCAD +ABAACCCBADD +BAAAAACBADB +BAAACCBAAAC +ABBAABACCAC +BBBAACCADAC +AAAACCBDBBB +BABACAADBDC +AAAAAACCDBD +BBBABCBDDBC +ABBABACCCDA +AABAABCBCAD +BAAABACCCDB +BBAABCAACCC +BABABBCDCCA +AABACCBACDB +BBAAACAABBC +AAAACBBAAAA +AAAABCCDCCB +AABABCCBDAA +BBAACCCBADC +BBBABCBAABC +AAAABABCADB +ABBAAAADDAD +AAAAAABDDBA +BBAAAACCCDA +ABBACAABABD +BABACBCBABA +AAAABABBCCA +BBBAACAAABD +AAAACBAABBC +AABAACBCDCA +BBAABBCDBBC +ABAACCBBAAA +BAAACCAADCB +BBAAAACABAD +BAAABBCABDD +BBBAAABACCA +AABACCADBAC +BABABBBACCB +BAAACCBBABA +BBAAAACAADD +BAAAACBACAA +AAAAAACDBCD +AABABABCCDB +ABAAAAADBAC +ABAACAABABA +BABABBCDBBB +BBBABCBBDDD +BABABBCACBB +BABACCCABAB +ABAACCBAADB +AAAAABCBBCD +ABAACCBCCCD +BBBAAACBBCB +ABAAAAAADBC +AAAABBCDBCA +AABAABBABAC +ABBABBBBABD +BABAABAAADB +BABABBBDACA +BABABACDCDD +BBBACCCBAAB +ABAAABBBCDA +AAAABACBBBA +AABACBCBADA +BBAACCABCDA +BBBAABADADA +BBAACBBCDDD +BBAAACBCACC +BAAABBCDDDD +ABAABBCBBCA +BAAAAABCBCB +BBAAABCDDBB +ABAACAACBCC +AABACCABCCB +BAAACCADCBB +BBBAABCBDAD +BBAABBADCCB +ABAACABBCDC +BAAACACACCB +BBBACABDCDD +BBBAAACADAD +AAAAABADDAC +BBBAACCACBB +BBBABBABBDD +BABAACCADCD +ABBACBBACAC \ No newline at end of file diff --git a/Questions/BTS 2 - DST 2 - Sujet original.tex b/Questions/BTS 2 - DST 2 - Sujet original.tex index f0ed2a4..385e3a9 100644 --- a/Questions/BTS 2 - DST 2 - Sujet original.tex +++ b/Questions/BTS 2 - DST 2 - Sujet original.tex @@ -25,7 +25,7 @@ a : 2,3,4,5,6,7 - L'équation de la tangente $T$ à la courbe représentative $\mathscr C$ de $f$ en son point d'abscisse $0$ est donnée par $y=#b#x + #a*(b + 1)# $. vrfx - + $T$ est au-dessus de $\mathscr C$. + - $T$ est au-dessus de $\mathscr C$. + $T$ est au-dessous de $\mathscr C$. @@ -109,4 +109,4 @@ p : 2,3,4 -$#a#\cos\left(#2*p#\pi\right)$ - -$#b#\sin\left(#2*p#\pi\right)$ \ No newline at end of file + -$#b#\sin\left(#2*p#\pi\right)$ \ No newline at end of file diff --git a/Questions/BTS 2 - DST 2 - Sujets.log b/Questions/BTS 2 - DST 2 - Sujets.log index 9791c2a..ae3aa80 100644 --- a/Questions/BTS 2 - DST 2 - Sujets.log +++ b/Questions/BTS 2 - DST 2 - Sujets.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11) (preloaded format=pdflatex 2020.11.23) 8 NOV 2021 17:25 +This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.11) (preloaded format=pdflatex 2020.11.23) 12 NOV 2021 12:24 entering extended mode **"./BTS 2 - DST 2 - Sujets.tex" ("BTS 2 - DST 2 - Sujets.tex" @@ -166,20 +166,20 @@ File: l3backend-pdftex.def 2020-09-24 L3 backend support: PDF output (pdfTeX) ("BTS 2 - DST 2 - Sujets.aux") \openout1 = `"BTS 2 - DST 2 - Sujets.aux"'. -LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 56. -LaTeX Font Info: ... okay on input line 56. -LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 56. -LaTeX Font Info: ... okay on input line 56. -LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 56. -LaTeX Font Info: ... okay on input line 56. -LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 56. -LaTeX Font Info: ... okay on input line 56. -LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 56. -LaTeX Font Info: ... okay on input line 56. -LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 56. -LaTeX Font Info: ... okay on input line 56. -LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 56. -LaTeX Font Info: ... okay on input line 56. +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 59. +LaTeX Font Info: ... okay on input line 59. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 59. +LaTeX Font Info: ... okay on input line 59. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 59. +LaTeX Font Info: ... okay on input line 59. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 59. +LaTeX Font Info: ... okay on input line 59. +LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 59. +LaTeX Font Info: ... okay on input line 59. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 59. +LaTeX Font Info: ... okay on input line 59. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 59. +LaTeX Font Info: ... okay on input line 59. *geometry* driver: auto-detecting *geometry* detected driver: pdftex @@ -229,18 +229,18 @@ LaTeX Font Info: ... okay on input line 56. \makeMPintoPDFobject=\count273 \everyMPtoPDFconversion=\toks25 ) -LaTeX Font Info: Trying to load font information for U+rsfs on input line 65 +LaTeX Font Info: Trying to load font information for U+rsfs on input line 68 . (C:\Users\Echophile\AppData\Roaming\MiKTeX\tex/latex/jknappen\ursfs.fd File: ursfs.fd 1998/03/24 rsfs font definition file (jk) ) -LaTeX Font Info: Trying to load font information for U+msa on input line 65. +LaTeX Font Info: Trying to load font information for U+msa on input line 68. ("C:\Program Files\MiKTeX\tex/latex/amsfonts\umsa.fd" File: umsa.fd 2013/01/14 v3.01 AMS symbols A ) -LaTeX Font Info: Trying to load font information for U+msb on input line 65. +LaTeX Font Info: Trying to load font information for U+msb on input line 68. ("C:\Program Files\MiKTeX\tex/latex/amsfonts\umsb.fd" @@ -258,11 +258,11 @@ File: umsb.fd 2013/01/14 v3.01 AMS symbols B Here is how much of TeX's memory you used: 3325 strings out of 479799 42562 string characters out of 2879534 - 337871 words of memory out of 3000000 + 338899 words of memory out of 3000000 20305 multiletter control sequences out of 15000+200000 541128 words of font info for 45 fonts, out of 3000000 for 9000 1141 hyphenation exceptions out of 8191 - 66i,5n,72p,360b,224s stack positions out of 5000i,500n,10000p,200000b,50000s + 66i,5n,72p,360b,239s stack positions out of 5000i,500n,10000p,200000b,50000s -Output written on "BTS 2 - DST 2 - Sujets.pdf" (89 pages, 471558 bytes). +Output written on "BTS 2 - DST 2 - Sujets.pdf" (89 pages, 479832 bytes). PDF statistics: 427 PDF objects out of 1000 (max. 8388607) 0 named destinations out of 1000 (max. 500000) diff --git a/Questions/BTS 2 - DST 2 - Sujets.pdf b/Questions/BTS 2 - DST 2 - Sujets.pdf index 3d81ded..84fc501 100644 Binary files a/Questions/BTS 2 - DST 2 - Sujets.pdf and b/Questions/BTS 2 - DST 2 - Sujets.pdf differ diff --git a/Questions/BTS 2 - DST 2 - Sujets.tex b/Questions/BTS 2 - DST 2 - Sujets.tex index 2b9d92b..626f980 100644 --- a/Questions/BTS 2 - DST 2 - Sujets.tex +++ b/Questions/BTS 2 - DST 2 - Sujets.tex @@ -50,8 +50,11 @@ \stepcounter{NumeroDeLaQuestion} } -\let\Vrai\item -\let\Faux\item +%\let\Vrai\item +%\let\Faux\item + +\def\Vrai#1{\item{\color{green}#1}} +\def\Faux#1{\item{\color{red}#1}} \begin{document} @@ -86,7 +89,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -258,7 +261,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -602,7 +605,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -1118,7 +1121,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -1290,7 +1293,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -1462,7 +1465,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -1978,7 +1981,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -2494,7 +2497,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -2666,7 +2669,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -2838,7 +2841,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -3010,7 +3013,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -3526,7 +3529,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -3870,7 +3873,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -4214,7 +4217,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -4730,7 +4733,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -4902,7 +4905,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -5074,7 +5077,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -6278,7 +6281,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -6450,7 +6453,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -6622,7 +6625,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -6794,7 +6797,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -6966,7 +6969,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -7138,7 +7141,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -7310,7 +7313,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -8170,7 +8173,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -9890,7 +9893,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -10062,7 +10065,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -10578,7 +10581,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -10922,7 +10925,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -11094,7 +11097,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -11438,7 +11441,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -11610,7 +11613,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -12126,7 +12129,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -12814,7 +12817,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -13846,7 +13849,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -14018,7 +14021,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -14362,7 +14365,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -14534,7 +14537,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -14878,7 +14881,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} @@ -15222,7 +15225,7 @@ On admet que son approximation quadratique est donné par\par $\qquad f\left(x\r \begin{VraiFaux} -\Vrai{ $T$ est au-dessus de $\mathscr C$.} +\Faux{ $T$ est au-dessus de $\mathscr C$.} \end{VraiFaux} diff --git a/elm-stuff/0.19.1/CalculateurDeNote.elmi b/elm-stuff/0.19.1/CalculateurDeNote.elmi new file mode 100644 index 0000000..b8f4961 Binary files /dev/null and b/elm-stuff/0.19.1/CalculateurDeNote.elmi differ diff --git a/elm-stuff/0.19.1/CalculateurDeNote.elmo b/elm-stuff/0.19.1/CalculateurDeNote.elmo new file mode 100644 index 0000000..3b974ab Binary files /dev/null and b/elm-stuff/0.19.1/CalculateurDeNote.elmo differ diff --git a/elm-stuff/0.19.1/GenerateurDeProblemes.elmi b/elm-stuff/0.19.1/GenerateurDeProblemes.elmi new file mode 100644 index 0000000..10f8bdf Binary files /dev/null and b/elm-stuff/0.19.1/GenerateurDeProblemes.elmi differ diff --git a/elm-stuff/0.19.1/GenerateurDeProblemes.elmo b/elm-stuff/0.19.1/GenerateurDeProblemes.elmo new file mode 100644 index 0000000..6fea9e2 Binary files /dev/null and b/elm-stuff/0.19.1/GenerateurDeProblemes.elmo differ diff --git a/elm-stuff/0.19.1/QCM.elmi b/elm-stuff/0.19.1/QCM.elmi index 9ac8dbe..6378002 100644 Binary files a/elm-stuff/0.19.1/QCM.elmi and b/elm-stuff/0.19.1/QCM.elmi differ diff --git a/elm-stuff/0.19.1/QCM.elmo b/elm-stuff/0.19.1/QCM.elmo index cb2cc34..321c4bf 100644 Binary files a/elm-stuff/0.19.1/QCM.elmo and b/elm-stuff/0.19.1/QCM.elmo differ diff --git a/elm-stuff/0.19.1/d.dat b/elm-stuff/0.19.1/d.dat index cfd63e6..05505af 100644 Binary files a/elm-stuff/0.19.1/d.dat and b/elm-stuff/0.19.1/d.dat differ diff --git a/elm-stuff/0.19.1/i.dat b/elm-stuff/0.19.1/i.dat index 126b144..e230b08 100644 Binary files a/elm-stuff/0.19.1/i.dat and b/elm-stuff/0.19.1/i.dat differ diff --git a/elm-stuff/0.19.1/o.dat b/elm-stuff/0.19.1/o.dat index c6505b8..f22f2a7 100644 Binary files a/elm-stuff/0.19.1/o.dat and b/elm-stuff/0.19.1/o.dat differ diff --git a/elm.json b/elm.json index a90f155..8cfe022 100644 --- a/elm.json +++ b/elm.json @@ -12,7 +12,8 @@ "elm/parser": "1.1.0", "elm/random": "1.0.0", "elm-community/random-extra": "3.2.0", - "lynn/elm-arithmetic": "3.0.0" + "lynn/elm-arithmetic": "3.0.0", + "mdgriffith/elm-ui": "1.1.8" }, "indirect": { "elm/json": "1.1.3", diff --git a/src/CalculateurDeNotes.elm b/src/CalculateurDeNotes.elm new file mode 100644 index 0000000..24fcf2c --- /dev/null +++ b/src/CalculateurDeNotes.elm @@ -0,0 +1,538 @@ +module CalculateurDeNotes exposing (..) + +import Browser +import Html exposing (Html) +import Element exposing (..) +import Element.Input as Input +import Set +import Array exposing (..) +import Parser exposing (..) + + + +{- + ███ ███ █████ ██ ███ ██ + ████ ████ ██ ██ ██ ████ ██ + ██ ████ ██ ███████ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ██ ████ +-} + +main = + Browser.element + { init = init + , update = update + , subscriptions = subscriptions + , view = view + } + + + +{- + ███ ███ ██████ ██████ ███████ ██ + ████ ████ ██ ██ ██ ██ ██ ██ + ██ ████ ██ ██ ██ ██ ██ █████ ██ + ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██████ ██████ ███████ ███████ +-} + +type alias Model = + { bareme : String + , reponsesCorrectes : String + , reponsesEleves : String + , eleves : Eleves + } + +init : () -> (Model, Cmd Msg) +init _ = + ( { bareme = "" + , reponsesCorrectes = "" + , reponsesEleves = "" + , eleves = [] + } + , Cmd.none + ) + + + +{- + ██ ██ ██████ ██████ █████ ████████ ███████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██████ ██ ██ ███████ ██ █████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██████ ██ ██████ ██ ██ ██ ███████ +-} + +type Msg + = NouveauBareme String + | NouvellesReponsesCorrectes String + | NouvellesReponsesEleves String + -- | CalculerNotes + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + let + brms = unsafeRun baremeSujet [] model.bareme + rpnCorrectes = unsafeRun reponsesCorrectes Array.empty model.reponsesCorrectes + rpnEleves = unsafeRun reponsesEleves [] model.reponsesEleves + in + case msg of + NouveauBareme nouveauBareme -> + let + brmss = unsafeRun baremeSujet [] nouveauBareme + in + ( { model + | bareme = nouveauBareme + , eleves = notes brmss rpnCorrectes rpnEleves + } + , Cmd.none + ) + NouvellesReponsesCorrectes nouvellesReponsesCorrectes -> + let + rpnCorrectess = unsafeRun reponsesCorrectes Array.empty nouvellesReponsesCorrectes + in + ( { model + | reponsesCorrectes = nouvellesReponsesCorrectes + , eleves = notes brms rpnCorrectess rpnEleves + } + , Cmd.none + ) + NouvellesReponsesEleves nouvellesReponsesEleves -> + let + rpnElevess = unsafeRun reponsesEleves [] nouvellesReponsesEleves + in + ( { model + | reponsesEleves = nouvellesReponsesEleves + , eleves = notes brms rpnCorrectes rpnElevess + } + , Cmd.none + ) + {-- + CalculerNotes -> + ( { model | eleves = notes brms rpnCorrectes rpnEleves } + , Cmd.none + ) + --} + +unsafeRun prsr defaut texte = + case run prsr texte of + Ok x -> x + _ -> defaut + + +-- SUBSCRIPTIONS + +subscriptions : Model -> Sub Msg +subscriptions model = + Sub.none + + +{- + + ██ ██ ██ ███████ ██ ██ + ██ ██ ██ ██ ██ ██ + ██ ██ ██ █████ ██ █ ██ + ██ ██ ██ ██ ██ ███ ██ + ████ ██ ███████ ███ ███ +-} + +view : Model -> Html Msg +view model = + layout [] <| + row [spacing grandEspacement, padding tresGrandEspacement, height fill, width fill, clip, scrollbars] + [ column [spacing petitEspacement, height fill, width fill, clip, scrollbars] + [ Input.multiline [height <| maximum 300 fill, clip, scrollbars] + { onChange = NouveauBareme + , label = Input.labelAbove [] <| text "Barème" + , placeholder = + Just + <| Input.placeholder [] + <| text "Entrer le barème sous la forme +3 -1, +2 -1" + , text = model.bareme + , spellcheck = False + } + , Input.multiline [height <| maximum 300 fill, clip, scrollbars] + { onChange = NouvellesReponsesCorrectes + , label = Input.labelAbove [] <| text "Réponses correctes" + , placeholder = + Just + <| Input.placeholder [] + <| text "Entrer les réponses correctes pour chaque sujet" + , text = model.reponsesCorrectes + , spellcheck = False + } + , Input.multiline [height <| maximum 300 fill, clip, scrollbars] + { onChange = NouvellesReponsesEleves + , label = Input.labelAbove [] <| text "Réponses des élèves" + , placeholder = + Just + <| Input.placeholder [] + <| text "Entrer les réponses des élèves" + , text = model.reponsesEleves + , spellcheck = False + } + ] + , column [spacing petitEspacement, height fill, width fill] + [ {-- Input.button [] + { onPress = Just CalculerNotes + , label = text "Calculer les notes" + } + --} + voirNotes model.eleves + ] + ] + +voirNotes : Eleves -> Element Msg +voirNotes rpnsEleves = + table [] + { data = rpnsEleves + , columns = + [ { header = Element.text "Numéro étudiant" + , width = fill + , view = + \rpns -> + Element.text rpns.numeroEtudiant + } + , { header = Element.text "Note" + , width = fill + , view = + \rpns -> + case rpns.note of + Nothing -> Element.text "" + Just nt -> Element.text <| String.fromFloat nt + } + ] + } + +petitEspacement = 20 + +grandEspacement = 5*petitEspacement // 4 + +tresGrandEspacement = 25*petitEspacement // 16 + +{- + ██████ █████ ██████ ███████ ███ ███ ███████ + ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ + ██████ ███████ ██████ █████ ██ ████ ██ █████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██████ ██ ██ ██ ██ ███████ ██ ██ ███████ +-} + + +{-- +baremeEtReponses = + succeed (\brm rpn -> BaremeEtReponses brm (List.map (String.split "") rpn)) + |= baremeSujet + |= reponses +--} + + +type alias BaremeSujet = List BaremeQuestion + +baremeSujet = + sequence + { start = "" + , separator = "," + , end = "" + , spaces = espaces + , item = baremeQuestion + , trailing = Forbidden + } + +espaces = + chompWhile <| (==) ' ' + + +type alias BaremeQuestion = + { bonneReponse : Float + , mauvaiseReponse : Float + } + +baremeQuestion = + succeed BaremeQuestion + |= nombre + |. spaces + |= nombre + +nombre : Parser Float +nombre = + oneOf + [ succeed negate + |. symbol "-" + |= float + , succeed identity + |. symbol "+" + |= float + ] + +{- + ██████ ███████ ██████ ██████ ███ ██ ███████ ███████ ███████ + ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ + ██████ █████ ██████ ██ ██ ██ ██ ██ ███████ █████ ███████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ███████ ██ ██████ ██ ████ ███████ ███████ ███████ +-} +type alias ReponsesCorrectes = Array Reponses + +reponsesCorrectes : Parser ReponsesCorrectes +reponsesCorrectes = + succeed Array.fromList + |= sequence + { start = "" + , separator = "\n" + , end = "" + , spaces = espaces + , item = reponses + , trailing = Optional + } + + +type alias Reponses = List String + +reponses = + sequence + { start = "" + , separator = "" + , end = "" + , spaces = espaces + , item = variable + { start = ( \ x -> x /= '\n' && x /= ';' ) + , inner = \_ -> False + , reserved = Set.fromList [] + } + , trailing = Optional + } + + +type alias Eleves = List Eleve + +reponsesEleves : Parser Eleves +reponsesEleves = + sequence + { start = "" + , separator = "\n" + , end = "" + , spaces = espaces + , item = reponsesEleve + , trailing = Optional + } + + + +{- + ███████ ██ ███████ ██ ██ ███████ ███████ + ██ ██ ██ ██ ██ ██ ██ + █████ ██ █████ ██ ██ █████ ███████ + ██ ██ ██ ██ ██ ██ ██ + ███████ ███████ ███████ ████ ███████ ███████ +-} + + +type alias Eleve = + { numeroEtudiant : String + , numeroSujet : Int + , reponses : Reponses + , note : Maybe Float + } + +reponsesEleve = + succeed Eleve + |= etudiant + |= int + |. champzInteret + |. champzInteret + |= reponsesQuizScan + |= champzInteret + +etudiant = + getChompedString + <| chompIf Char.isDigit + |. chompIf Char.isDigit + |. chompIf Char.isDigit + |. chompIf Char.isDigit + |. chompIf Char.isDigit + +champzInteret = + succeed Nothing + |. symbol ";" + |. chompWhile ( \ x -> x /= '\n' && x /= ';' ) + +reponsesQuizScan = + sequence + { start = ";" + , separator = ";" + , end = "" + , spaces = espaces + , item = variable + { start = ( \ x -> x /= '\n' && x /= ';' ) + , inner = \_ -> False + , reserved = Set.fromList [] + } + , trailing = Mandatory + } + +notes : BaremeSujet -> ReponsesCorrectes -> Eleves -> Eleves +notes brms rpnCorrectes rpnEleves = + let + f rpnEleve = + case Array.get (rpnEleve.numeroSujet - 11) rpnCorrectes of + Nothing -> rpnEleve + Just bonneRpns -> + { rpnEleve | note = noteSujet brms bonneRpns rpnEleve.reponses } + in + List.map f rpnEleves + +noteSujet : BaremeSujet -> Reponses -> Reponses -> Maybe Float +noteSujet brms bonneRpns rpnsEleve = + case brms of + [] -> Just 0 + brm :: brmss -> + let + bonneRpn = List.head bonneRpns + bonneRpnSuite = List.tail bonneRpns + rpnEleve = List.head rpnsEleve + rpnEleveSuite = List.tail rpnsEleve + in + case ( (bonneRpn, bonneRpnSuite), (rpnEleve, rpnEleveSuite) ) of + ( (Just bnRpn, Just bnRpnSuite), (Just rpnElv, Just rpnElvSuite) ) -> + noteSujet brmss bnRpnSuite rpnElvSuite + |> Maybe.andThen ( Just << (+) ( noteQuestion brm bnRpn rpnElv ) ) + _ -> Nothing + +noteQuestion brm bonneRpn rpnEleve = + if bonneRpn == rpnEleve then + brm.bonneReponse + else if rpnEleve == "-" then + 0 + else + brm.mauvaiseReponse + + +monBareme = "+1 -1, +1 -1, +1 -1, +1 -1, +2 -1, +2 -1, +2 -1, +3 -1, +3 -1, +3 -1, +3 -1" + +mesReonses = + """ABBACBBBCDB +BABABCBDCAD +ABAACCCBADD +BAAAAACBADB +BAAACCBAAAC +ABBAABACCAC +BBBAACCADAC +AAAACCBDBBB +BABACAADBDC +AAAAAACCDBD +BBBABCBDDBC +ABBABACCCDA +AABAABCBCAD +BAAABACCCDB +BBAABCAACCC +BABABBCDCCA +AABACCBACDB +BBAAACAABBC +AAAACBBAAAA +AAAABCCDCCB +AABABCCBDAA +BBAACCCBADC +BBBABCBAABC +AAAABABCADB +ABBAAAADDAD +AAAAAABDDBA +BBAAAACCCDA +ABBACAABABD +BABACBCBABA +AAAABABBCCA +BBBAACAAABD +AAAACBAABBC +AABAACBCDCA +BBAABBCDBBC +ABAACCBBAAA +BAAACCAADCB +BBAAAACABAD +BAAABBCABDD +BBBAAABACCA +AABACCADBAC +BABABBBACCB +BAAACCBBABA +BBAAAACAADD +BAAAACBACAA +AAAAAACDBCD +AABABABCCDB +ABAAAAADBAC +ABAACAABABA +BABABBCDBBB +BBBABCBBDDD +BABABBCACBB +BABACCCABAB +ABAACCBAADB +AAAAABCBBCD +ABAACCBCCCD +BBBAAACBBCB +ABAAAAAADBC +AAAABBCDBCA +AABAABBABAC +ABBABBBBABD +BABAABAAADB +BABABBBDACA +BABABACDCDD +BBBACCCBAAB +ABAAABBBCDA +AAAABACBBBA +AABACBCBADA +BBAACCABCDA +BBBAABADADA +BBAACBBCDDD +BBAAACBCACC +BAAABBCDDDD +ABAABBCBBCA +BAAAAABCBCB +BBAAABCDDBB +ABAACAACBCC +AABACCABCCB +BAAACCADCBB +BBBAABCBDAD +BBAABBADCCB +ABAACABBCDC +BAAACACACCB +BBBACABDCDD +BBBAAACADAD +AAAAABADDAC +BBBAACCACBB +BBBABBABBDD +BABAACCADCD +ABBACBBACAC""" + +mesEleves = + """2000126;rayan;;B;B;A;B;B;-;B;D;A;D;-;; +2000224;selena;;B;B;A;A;B;-;C;B;B;-;-;; +2000527;maryam;;B;-;B;-;B;-;A;A;D;A;-;; +2000728;juliette;;A;-;-;-;A;C;A;D;C;C;-;; +2000829;ma?v?ne;;A;A;-;B;B;C;-;A;A;-;-;; +2000891;ma?v?ne;;B;B;B;B;C;A;C;B;C;D;C;; +2000948;mathilde;;B;B;A;B;C;B;A;-;-;-;-;; +2001047;lucille;;A;B;A;B;A;A;-;A;A;A;D;; +2001160;marie;;B;B;A;-;C;-;A;-;-;-;-;; +2001458;issra;;A;B;A;B;A;A;C;B;A;B;-;; +2001732;audrey;;B;B;A;A;C;C;C;-;-;-;-;; +2001834;emeric;;A;A;A;A;-;A;B;-;-;-;-;; +2001944;lamia;;A;B;B;A;A;B;A;D;C;A;C;; +2002030;adrien;;A;B;A;A;A;A;C;-;-;-;B;; +2002128;bettina;;B;B;A;A;A;C;C;A;B;-;-;; +2002333;samuel;;B;B;B;B;-;C;-;A;B;-;-;; +2002439;marl?ne;;B;B;A;A;A;B;C;B;A;B;D;; +2003684;vincent;;B;A;A;A;A;A;B;C;D;C;B;; +2000632;chiche;;B;B;A;B;A;C;C;B;A;-;-;; +2000334;BOUDRY;;A;B;A;A;-;-;A;C;-;-;-;; +2001641;GUERIN;;A;B;B;A;-;B;B;A;-;B;-;; +2002514;NGEUMELEU;;A;B;A;A;B;C;B;B;A;B;B;; +2002215;MEJJATI;;A;A;B;A;B;C;A;D;C;C;-;; +2002790;NICOISE;;A;B;A;A;A;B;B;A;A;A;A;; +2003293;SCHEPENS;;B;B;B;A;C;A;C;D;D;D;D;; +2000430;BOUHNIK;;A;A;B;A;B;C;B;D;C;-;-;; +2003392;SERGEANT;;B;A;A;A;C;A;A;-;-;-;-;; +2002986;PEREZ;;A;B;A;B;-;A;B;-;-;B;-;; +2003710;PERROT;;A;B;A;A;B;A;C;D;C;A;D;; +2003585;SUNNASSEE;;B;B;A;A;C;A;C;D;B;C;A;; +2003110;QIU;;B;A;A;A;C;A;C;A;B;C;A;; +2001356;ESTIVAL;;A;A;B;A;C;B;B;C;B;D;C;; +2001546;GRANDJEAN;;B;A;B;A;-;C;-;A;D;C;B;; +2001262;DUFRIEN;;B;A;-;A;-;C;-;B;C;-;D;;""" \ No newline at end of file diff --git a/src/GenerateurDeProblemes.elm b/src/GenerateurDeProblemes.elm new file mode 100644 index 0000000..f41fb0b --- /dev/null +++ b/src/GenerateurDeProblemes.elm @@ -0,0 +1,734 @@ +module GenerateurDeProblemes exposing (..) + +import Browser +import Parser as P exposing (..) +import List as L +import Set +import ParserMaths as PM +import String as S +import Fractions as F exposing (Frac) +import Html exposing (Html, Attribute, button, div, textarea, input, p, iframe, section) +--import Html.Attributes as A -- exposing (..) +--import Html.Events +import Random +import Random.Extra +import Random.List +import Element exposing (..) +import Element.Background as Background +import Element.Border as Border +import Element.Events exposing (..) +import Element.Font as Font +import Element.Input as Input + + +{- + ███ ███ █████ ██ ███ ██ + ████ ████ ██ ██ ██ ████ ██ + ██ ████ ██ ███████ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ██ ████ +-} + +main = + Browser.element + { init = init + , update = update + , subscriptions = subscriptions + , view = view + } + + +{- + ███ ███ ██████ ██████ ███████ ██ + ████ ████ ██ ██ ██ ██ ██ ██ + ██ ████ ██ ██ ██ ██ ██ █████ ██ + ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██████ ██████ ███████ ███████ +-} + +type alias Model = + { structureDuSujet : String + , sujetGenere : String + } + +init : () -> (Model, Cmd Msg) +init _ = + ( { structureDuSujet = "" + , sujetGenere = "" + } + , Cmd.none + ) + +{- + ██ ██ ██████ ██████ █████ ████████ ███████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██████ ██ ██ ███████ ██ █████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██████ ██ ██████ ██ ██ ██ ███████ +-} + +type Msg + = StructureDuSujet String + | GenererSujet + | SujetGenere String + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + StructureDuSujet nouvelleStructure -> + ( { model | structureDuSujet = nouvelleStructure } + , Cmd.none + ) + SujetGenere nouveauSujetGenere -> + ( { model | sujetGenere = nouveauSujetGenere } + , Cmd.none + ) + GenererSujet -> + let + f strSuj = + case P.run (withIndent -1 sujet) strSuj of + Ok sjt -> Random.map quizScanVoirBlocs <| sujetsAleatoires sjt + Err erreurs -> Random.constant <| deadEndsToStringBis erreurs + in + ( model + , Random.generate SujetGenere (f model.structureDuSujet) + ) + + +-- SUBSCRIPTIONS + +subscriptions : Model -> Sub Msg +subscriptions model = + Sub.none + + +{- + + ██ ██ ██ ███████ ██ ██ + ██ ██ ██ ██ ██ ██ + ██ ██ ██ █████ ██ █ ██ + ██ ██ ██ ██ ██ ███ ██ + ████ ██ ███████ ███ ███ +-} + +view : Model -> Html Msg +view model = + layout [] <| + column [height fill, width fill] + [ Input.multiline [] + { onChange = StructureDuSujet + , label = Input.labelHidden "chose" + , placeholder = Just <| Input.placeholder [] <| text "Structure du sujet" + , text = model.structureDuSujet + , spellcheck = True + } + , Input.button [] + { onPress = Just GenererSujet + , label = text "Générer le sujet" + } + , text model.sujetGenere + ] + + +{- +██████ █████ ██████ ███████ ███████ ██████ ███████ ██ ██ ██ ███████ ████████ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +██████ ███████ ██████ ███████ █████ ██████ ███████ ██ ██ ██ █████ ██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +██ ██ ██ ██ ██ ███████ ███████ ██ ██ ███████ ██████ █████ ███████ ██ +-} + +type alias Blocs = List Bloc + +type Bloc = + Sujet (List Bloc) + | VariableAremplacer Aremplacer Blocs + | Entete Macro Blocs + | QCM Macro Propositions + | VraiFaux Propositions + +type alias Propositions = List Proposition + +type Proposition = + Vrai Macro + | Faux Macro + +type alias NombreDeLigne = Int + +{-- +voirBlocsParse blocsPotentiel = + case P.run (withIndent -1 blocs) blocsPotentiel of + Ok sjt -> voirBlocs sjt + Err erreurs -> deadEndsToStringBis erreurs +--} + +voirBlocsParseAleatoire blocsPotentiel = + case P.run (withIndent -1 blocs) blocsPotentiel of + Ok sjt -> Random.map quizScanVoirBlocs <| blocsAleatoires sjt + Err erreurs -> Random.constant <| deadEndsToStringBis erreurs + +deadEndsToStringBis errs = + errs + |> List.map voirErreur + |> String.concat + |> (++) "Il y a des problèmes aux endroits suivants :\n" + +voirErreur err = + "Ligne : " ++ String.fromInt err.row + ++ " | Colonne : " ++ String.fromInt err.col + +{-- +voirBlocs = S.join "\n" << L.map voirBloc + +voirBloc prblm = + -- Debug.log "voirBloc " <| + case prblm of + Entete mcr sjt -> + voirMacro mcr + ++ "\n" + ++ voirBlocs sjt + VraiFaux prps -> + let + f prp = + case prp of + Vrai mcr -> voirMacro mcr + Faux mcr -> voirMacro mcr + in + S.join "\n" <| L.map f prps + VariableAremplacer ar sjt -> "" ++ voirBlocs sjt +--} + +sujet : Parser Blocs +sujet = + succeed (L.singleton << Sujet) + |= blocs + +blocs : Parser Blocs +blocs = + let + problemes prblms = + let + boucle = + -- Debug.log "Boucle sur un bloc (bis) " <| + succeed ( \prblm -> Loop (prblm :: prblms) ) + |= bloc + fin = + P.map (\_ -> Done (List.reverse prblms)) + suite col_ind = + oneOf + [ succeed () + |. end + |> fin + , if Tuple.first col_ind > Tuple.second col_ind then -- if col > ind + boucle -- |> Debug.log "Boucle sur un bloc " + else + succeed () + |> fin + ] + -- |> Debug.log ( "Choix de l'embrachement dans la boucle (position " ++ S.fromInt (Tuple.first col_ind) ++ "x" ++ S.fromInt (Tuple.second col_ind) ++ ")" ) + in + succeed Tuple.pair + |. spaces + |= getCol + |= getIndent + |> andThen suite + in + loop [] problemes + +bloc : Parser Bloc +bloc = + let + suite = + flip withIndent + <| oneOf + [ vraiFaux + , qcm + , backtrackable variableAremplacer + , entete ] + in + getCol + |> andThen suite + +flip f a b = f b a + +reserve = Set.fromList + [ "qcm" + , "vrfx" + , "var" + ] + +sousBlocs = + let + suite col_ind = + if Tuple.first col_ind > Tuple.second col_ind then -- if col > ind + withIndent (Tuple.first col_ind) ( lazy (\_ -> blocs) ) -- Aucune idée de l'effet du lazy, ça marche sans... + else + succeed [] + in + succeed Tuple.pair + |. spaces + |= getCol + |= getIndent + |> andThen suite + +entete : Parser Bloc +entete = + -- Debug.log "entete " <| + succeed Entete + |= macro + |= blocs -- sousBlocs + +vraiFaux = + -- Debug.log "vraiFaux " <| + succeed VraiFaux + |. keyword "vrfx" + |= propositions + +qcm = + -- Debug.log "vraiFaux " <| + succeed QCM + |. keyword "qcm" + |. espaces + |= macro + |= propositions + +propositions = + let + suiteBis prps = + let + boucle = + oneOf + [ succeed ( \mcr -> Loop ( Vrai mcr :: prps ) ) + |. symbol "+" + |= macro + , succeed ( \mcr -> Loop ( Faux mcr :: prps ) ) + |. symbol "-" + |= macro + ] + fin = + P.map (\_ -> Done prps) + suite col_ind = + oneOf + [ succeed () + |. end + |> fin + , if Tuple.first col_ind > Tuple.second col_ind then -- if col > ind + boucle + else + succeed () + |> fin + ] + in + succeed Tuple.pair + |. spaces + |= getCol + |= getIndent + |> andThen suite + in + loop [] suiteBis + + +{- +██████ █████ ██████ ███████ ███████ ██████ ███ ███ █████ ██████ ██████ ██████ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ +██████ ███████ ██████ ███████ █████ ██████ ██ ████ ██ ███████ ██ ██████ ██ ██ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +██ ██ ██ ██ ██ ███████ ███████ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██████ +-} + +type TexteVariable + = Texte String + | Variable String + +type alias Macro + = List TexteVariable + +voirMacro = S.concat << L.map voirTexteVariable + +voirTexteVariable txtvar = + case txtvar of + Texte txt -> txt + Variable var -> + let + expressionParseePotentielle = PM.parseMaths var + in + case expressionParseePotentielle of + Err erreur -> "L'expression est mal formée." + Ok expressionParsee -> + case Maybe.map F.teX <| PM.evaluer <| expressionParsee of + Just a -> a + Nothing -> "Les puissances non-entières ne sont pas acceptées." + +texteSansVariables : Parser TexteVariable +texteSansVariables = + let + condition caractere = caractere /= '#' && caractere /= '\n' + in + succeed Texte + |= P.getChompedString ( + succeed () + |. P.chompIf condition + |. P.chompWhile condition + + ) + +expressionVariable : Parser TexteVariable +expressionVariable + = succeed Variable + |. symbol "#" + |= P.getChompedString ( P.chompUntil "#" ) + |. symbol "#" + +macro : Parser Macro +macro = + let + suite ls = + P.oneOf + [ succeed (\l -> P.Loop (l :: ls)) + |= P.oneOf + [ expressionVariable + , texteSansVariables + , backtrackable retourAlaLigne + ] + , succeed () + |> P.map (\_ -> P.Done (List.reverse ls)) + ] + in + P.loop [] suite + +retourAlaLigne = + let + suite ind = + succeed (Texte "\n") + |. token "\n" + |. token (S.repeat (ind - 1) " ") + in + getIndent + |> andThen suite + + +{- + ██████ █████ ██████ ███████ ███████ ██████ ██ ██ █████ ██████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██████ ███████ ██████ ███████ █████ ██████ ██ ██ ███████ ██████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ███████ ███████ ██ ██ ████ ██ ██ ██ ██ +-} + +type alias Variables = List Aremplacer + +type alias Aremplacer = + { var : String + , vals : List String + } + +parserAremplacer variables = + case P.run aRemplacer variables of + Ok ars -> ars + Err _ -> Aremplacer "" [] + +espaces = + chompWhile <| (==) ' ' + +variableAremplacer : Parser Bloc +variableAremplacer = + -- Debug.log "variableAremplacer " <| + succeed VariableAremplacer + |= aRemplacer + |= blocs -- sousBlocs + +aRemplacer : Parser Aremplacer +aRemplacer = + succeed ( \x y -> Aremplacer x (L.map (F.raw << PM.evaluerBis) y) ) + |. espaces + |= variable + { start = Char.isAlpha + , inner = Char.isAlpha + , reserved = reserve + } + |. espaces + |. symbol ":" + |= sequence + { start = "" + , separator = "," + , end = "" + , spaces = espaces + , item = PM.expr + , trailing = P.Optional + } + +{- +███████ ██ ████████ █████ ██ ███████ █████ ████████ ██████ ██ ██████ ███████ +██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +███████ ██ ██ ███████ ██ █████ ███████ ██ ██ ██ ██ ██████ █████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +███████ █████ ██ ██ ██ ███████ ███████ ██ ██ ██ ██████ ██ ██ ██ ███████ +-} + +sujetsAleatoires : Blocs -> Random.Generator Blocs +sujetsAleatoires sjt = + blocsAleatoires sjt + |> Random.list 89 + |> Random.map L.concat + +blocsAleatoires : Blocs -> Random.Generator Blocs +blocsAleatoires sjt = + Random.map L.concat + <| Random.Extra.sequence + <| L.map blocAleatoire sjt + +blocAleatoire : Bloc -> Random.Generator Blocs +blocAleatoire prblm = + case prblm of + Sujet blcs -> + Random.map (L.singleton << Sujet) (blocsAleatoires blcs) + VariableAremplacer ar sjt -> + let + vrbl = ar.var + vlr = valeurAleatoire "" ar.vals + f sj vl = remplacerLaVariableDansLesBlocsAleatoires vrbl vl sj + in + {-- + Debug.log + ( "blocAleatoire, branche VariableAremplacer, variable : " + ++ vrbl ++ " " + ) <| + --} + Random.andThen (f sjt) vlr + Entete mcr sjt -> + Random.map (L.singleton << Entete mcr) (blocsAleatoires sjt) + VraiFaux prps -> + Random.map + (L.singleton << VraiFaux << L.singleton) + ( valeurAleatoire ( Vrai [ Texte "Le prof de maths est le meilleur." ] ) prps ) + QCM mcr prps -> + Random.map + (L.singleton << QCM mcr) + (Random.List.shuffle prps ) + +{-| Permet de prendre un élément aléatoire dans une liste + avec une valeur par défaut si la liste est vide. +-} +valeurAleatoire : a -> List a -> Random.Generator a +valeurAleatoire f fs = + case fs of + [] -> + Random.constant f + ff :: fss -> + Random.uniform ff fss + +remplacerLaVariableDansLeBlocAleatoire : + String -> String -> Bloc -> Random.Generator Blocs +remplacerLaVariableDansLeBlocAleatoire vrbl vlr prblm = + case prblm of + Sujet blcs -> + remplacerLaVariableDansLesBlocsAleatoires vrbl vlr blcs + VariableAremplacer ar sjt -> + blocAleatoire (VariableAremplacer ar sjt) + |> Random.andThen (remplacerLaVariableDansLesBlocsAleatoires vrbl vlr) + Entete mcr sjt -> + Random.map L.singleton + <| Random.map2 Entete + ( Random.constant <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr ) + ( remplacerLaVariableDansLesBlocsAleatoires vrbl vlr sjt ) + QCM mcr prps -> + Random.map L.singleton + <| Random.map2 QCM + ( Random.constant <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr ) + ( Random.List.shuffle + <| L.map (remplacerLaVariableParLaValeurDansLaProposition vrbl vlr) prps + ) + VraiFaux prps -> + Random.map + ( L.singleton + << VraiFaux + << L.singleton + << remplacerLaVariableParLaValeurDansLaProposition vrbl vlr + ) + <| valeurAleatoire ( Vrai [ Texte "Le prof de maths est le meilleur." ] ) prps + +remplacerLaVariableDansLesBlocsAleatoires : + String -> String -> Blocs -> Random.Generator Blocs +remplacerLaVariableDansLesBlocsAleatoires vrbl vlr sjt = + Random.map L.concat + <| Random.Extra.sequence + <| L.map (remplacerLaVariableDansLeBlocAleatoire vrbl vlr) sjt + +remplacerLaVariableParLaValeurDansLaProposition vrbl vlr prp = + case prp of + Vrai mcr -> Vrai <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr + Faux mcr -> Faux <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr + + +{- + ██████ ██ ██ ██ ███████ ███████ ██████ █████ ███ ██ + ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ████ ██ + ██ ██ ██ ██ ██ ███ ███████ ██ ███████ ██ ██ ██ + ██ ▄▄ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ + ██████ ██████ ██ ███████ ███████ ██████ ██ ██ ██ ████ + ▀▀ +-} + +quizScanVoirBlocs : Blocs -> String +quizScanVoirBlocs blcs = + S.join "\n" <| L.map quizScanVoirBloc blcs + +quizScanVoirBloc prblm = + case prblm of + Sujet blcs -> + "\n\\begin{Sujet}\n" + ++ quizScanVoirBlocs blcs + ++ "\n\\end{Sujet}" + Entete mcr sjt -> + -- "\n \\begin{itemize}\n \\item " + voirMacro mcr + ++ "\n" + ++ quizScanVoirBlocs sjt + -- ++ " \\end{itemize}" + QCM mcr prps -> + let + f prp = + case prp of + Vrai mc -> + " \\Vrai{" ++ voirMacro mc ++ "}" + Faux mc -> + " \\Faux{" ++ voirMacro mc ++ "}" + in + "\n \\begin{QCM}\n" + ++ voirMacro mcr + ++ "\n \\begin{enumerate}\n" + ++ ( S.join "\n" <| L.map f prps ) + ++ "\n \\end{enumerate}\n \\end{QCM}" + VraiFaux prps -> + let + f prp = + case prp of + Vrai mc -> + "\n \\begin{VraiFaux}\n \\Vrai{" ++ voirMacro mc ++ "}\n \\end{VraiFaux}" + Faux mc -> + "\n \\begin{VraiFaux}\n \\Faux{" ++ voirMacro mc ++ "}\n \\end{VraiFaux}" + in + S.concat <| L.map f prps + VariableAremplacer ar sjt -> + "" ++ quizScanVoirBlocs sjt + + + +{- + ███ ███ ██ ██ ██ ███████ ██ ██ ██████ + ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ████ ██ ██ ███ █████ ██ ██ ██████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ██ ██ ██ ██ ██ ███████ ██████ ██ ██ +-} + +{-- +remplacer : String -> String -> List String +remplacer variables question = + let + ars = + S.lines variables + |> L.map parserAremplacer + mcr = + parserQuestion question + in + remplacerLesVariablesDansLaMacro ars mcr + +remplacerLesVariablesDansLaMacro : List Aremplacer -> Macro -> List String +remplacerLesVariablesDansLaMacro ars mcr = + remplacerLesVariablesDansLaMacroBis ars [mcr] + |> L.map voirMacro + +remplacerLesVariablesDansLaMacroBis : List Aremplacer -> List Macro -> List Macro +remplacerLesVariablesDansLaMacroBis ars macros = + case ars of + [] -> macros + ar :: arss -> + L.map (remplacerLaVariableDansLaMacro ar) macros + |> L.concat + |> remplacerLesVariablesDansLaMacroBis arss + +remplacerLaVariableDansLaMacro : Aremplacer -> Macro -> List Macro +remplacerLaVariableDansLaMacro ar mcr = + let + f val = remplacerLaVariableParLaValeurDansLaMacro ar.var val mcr + in + L.map f ar.vals +--} + +remplacerLaVariableParLaValeurDansLaMacro : String -> String -> Macro -> Macro +remplacerLaVariableParLaValeurDansLaMacro var val mcr = + L.map (remplacerLaVariableParLaValeurDansLeTexteVariable var val) mcr + +remplacerLaVariableParLaValeurDansLeTexteVariable var val tv = + case tv of + Texte chaine -> Texte chaine + Variable chaine -> Variable <| S.replace var val chaine +--} + + +{- + + ███████ ██ ██ ██████ ██████ ███████ ███████ ███████ ██ ██████ ███ ██ ███████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ + █████ ███ ██████ ██████ █████ ███████ ███████ ██ ██ ██ ██ ██ ██ ███████ + ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ███████ ██ ██ ██ ██ ██ ███████ ███████ ███████ ██ ██████ ██ ████ ███████ + + + +-} + +monome a n = + if a == 0 then "" + else if n == 0 then ( String.fromInt a ) + else if (n,a) == (1,1) then "x" + else if (n,a) == (1,-1) then "-x" + else if n == 1 then ( String.fromInt a ) ++ "x" + else if a == 1 then "x^{" ++ ( String.fromInt n ) ++ "}" + else if a == -1 then "-x^{" ++ ( String.fromInt n ) ++ "}" + else ( String.fromInt a ) ++ "x^{" ++ ( String.fromInt n ) ++ "}" + +poly a_ks = + if a_ks == [] then "0" + else polyBis a_ks ( List.length a_ks - 1 ) + +polyBis a_ks n = + case a_ks of + [] -> "" + a_n :: a_kss -> + if a_n == 0 then polyBis a_kss ( n - 1 ) + else ( monome a_n n ) ++ ( polyGen a_kss ( n - 1 ) ) + +polyGen a_ks n = + case a_ks of + [] -> "" + a_i :: a_is -> + if a_i <= 0 then ( monome a_i n ) ++ ( polyGen a_is ( n - 1 ) ) + else "+" ++ ( monome a_i n ) ++ ( polyGen a_is ( n - 1 ) ) + +polyD a_ks = polyDbis a_ks ( List.length a_ks - 1 ) + +polyDbis a_ks n = + case a_ks of + [] -> [] + a_0 :: [] -> [] + a_k :: a_kss -> ( n*a_k ) :: polyDbis a_kss ( n - 1 ) + +dl a_ks = + if a_ks == [] then "0" + else dlBis a_ks 0 + +dlBis a_ks n = + case a_ks of + [] -> "" + premierCoef :: suite -> + if premierCoef == 0 then dlBis suite ( n + 1 ) + else ( monome premierCoef n ) ++ ( dlGen suite ( n + 1 ) ) + +dlGen a_ks n = + case a_ks of + [] -> "" + a_i :: a_is -> + if a_i <= 0 then ( monome a_i n ) ++ ( dlGen a_is ( n + 1 ) ) + else "+" ++ ( monome a_i n ) ++ ( dlGen a_is ( n + 1 ) ) \ No newline at end of file diff --git a/src/QCM.elm b/src/QCM.elm deleted file mode 100644 index e87115a..0000000 --- a/src/QCM.elm +++ /dev/null @@ -1,1255 +0,0 @@ -module QCM exposing (..) - -import Browser -import Parser as P exposing (..) -{-- - ( Parser - , (|.) - , (|=) - , succeed - , symbol - , float - , spaces - , token - , loop - , getIndent - , andThen - , oneOf - , Step - ) ---} -import List as L -import Set -import ParserMaths as PM -import String as S -import Fractions as F exposing (Frac) -import Html exposing (Html, Attribute, button, div, textarea, input, p, iframe, section) -import Html.Attributes as A -- exposing (..) -import Html.Events exposing (onInput, onClick) -import Random -import Random.Extra -import Random.List - - -blocsTest = - """a : 2,4 - b : 3,5,8 - c : 6,7,9 - - On considère l'équation $#a#x^{2}-#b# x-#c#=0$ alors - le discriminant $\\Delta$ est égal à : - - vrfx - +$#b^2+4*a*c#$ - - -$#b^2-4*a*c#$ - """ - - -{- - ███ ███ █████ ██ ███ ██ - ████ ████ ██ ██ ██ ████ ██ - ██ ████ ██ ███████ ██ ██ ██ ██ - ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██ ██ ██ ██ ████ --} - -main = - Browser.element - { init = init - , update = update - , subscriptions = subscriptions - , view = view - } - - -{- - ███ ███ ██████ ██████ ███████ ██ - ████ ████ ██ ██ ██ ██ ██ ██ - ██ ████ ██ ██ ██ ██ ██ █████ ██ - ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██████ ██████ ███████ ███████ --} - -type alias Model = - { -- variables : String - structureDuSujet : String - -- , questions : List String - , sujetGenere : String - } - - -init : () -> (Model, Cmd Msg) -init _ = - ( { -- variables = "" - structureDuSujet = "" - -- , questions = [] - , sujetGenere = "" - } - , Cmd.none - ) - -{- - ██ ██ ██████ ██████ █████ ████████ ███████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██████ ██ ██ ███████ ██ █████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██████ ██ ██████ ██ ██ ██ ███████ --} - -type Msg - = StructureDuSujet String - -- | Variables String - | GenererSujet - | SujetGenere String - -update : Msg -> Model -> ( Model, Cmd Msg ) -update msg model = - case msg of - StructureDuSujet nouvelleStructure -> - ( { model | structureDuSujet = nouvelleStructure } - , Cmd.none - ) - SujetGenere nouveauSujetGenere -> - ( { model | sujetGenere = nouveauSujetGenere } - , Cmd.none - ) - GenererSujet -> - let - f strSuj = - case P.run (withIndent -1 sujet) strSuj of - Ok sjt -> Random.map quizScanVoirBlocs <| sujetsAleatoires sjt - Err erreurs -> Random.constant <| deadEndsToStringBis erreurs - in - ( model - , Random.generate SujetGenere (f model.structureDuSujet) - ) - --- SUBSCRIPTIONS - - -subscriptions : Model -> Sub Msg -subscriptions model = - Sub.none - - - -{- - - ██ ██ ██ ███████ ██ ██ - ██ ██ ██ ██ ██ ██ - ██ ██ ██ █████ ██ █ ██ - ██ ██ ██ ██ ██ ███ ██ - ████ ██ ███████ ███ ███ --} - -view : Model -> Html Msg -view model = - div [] - <| -- textarea [ A.placeholder "Liste des variables", A.value model.variables, onInput Variables ] [] - textarea [ A.placeholder "Structure du sujet", A.value model.structureDuSujet, onInput StructureDuSujet ] [] - -- :: button [ onClick GenererQuestion ] [ text "Générer les questions" ] - :: button [ onClick GenererSujet ] [ text "Générer un sujet au hasard" ] - -- :: ( section [] <| L.map (\q -> p [] [ text q ]) model.questions ) - :: [ ( Html.output [] [ Html.code [] [ text model.sujetGenere ] ] ) ] -- fonction text réécrite ci-dessous - {-- - :: text - ( - let expressionParseePotentielle = PM.parseMaths "3+(2/3)^-2/3" - in - case expressionParseePotentielle of - Err erreur -> "L'expression est mal formée." - Ok expressionParsee -> - case Maybe.map F.teX <| PM.evaluer <| expressionParsee of - Just a -> a - Nothing -> "Les puissances non-entières ne sont pas acceptées." - ) - :: L.map text - ( remplacer - [ Aremplacer "a" ["1","2"], Aremplacer "b" ["3","4"] ] - [ Texte "Calculer $", Variable "a" , Texte "+" , Variable "a+b" , Texte "$."] - ) - ++ L.map text (remplacer [] [Texte "chose"]) - ++ L.map text (remplacer [] [Texte "chose"]) - --} - - {-- - , [ dl05 [0, 4, 2] 5 ] - , [ text ( poly [0, 0, 7, -3, 0 , 2, 1 , -1 , 3 , 1, 1, 1, 5] ) ] - , [ primitLn01 [-5,-6] ] - , [ primitPoly01 [2,-5,1,7] ] -- J'ai oublié de les générer !!!!!!! - , [ equaDiff01 -5 ] - , [ equaDiff02 [4, -5] ] - , [ equaDiff03 [4, -5] ] - , [ derivPoly01 [4, -5, 3, 5, 13] ] - , [ derivPoly02 [-3, -4, 2, 7, -13] ] - , [ dl01 [-5, -2, 2, -1] ] - , [ dl02 [-5, 0, -2, -1] ] - , [ dl03 [0, -8, 0, 7] ] - , [ dl04 [-1, 2, 0, -3] ] - , List.map equaDiff01 <| List.range -99 -2 -- 98 possibilités OK - , List.map equaDiff02 ( mix [ [3,5,9,11,13,17,27,15,25,27], [-2,-4,-7,-8,-14,-16,-19,-23,-28,-29] ] ) -- 100 possibilités OK - , List.map equaDiff03 ( mix [ [3,5,9,11,13,17,27,15,25,27], [-2,-4,-7,-8,-14,-16,-19,-23,-28,-29] ] ) -- 100 possibilités OK - -- Pourries par un List.range -2 1 ++ List.range 1 2 qui passe à 900 et 768 possibilités dans evalbox, dont répétitions - , List.map derivPoly01 ( mix [ [2,4,6], List.range -6 -2, List.range 2 6, List.range -2 -1 ++ List.range 1 2, List.range 11 12 ] ) -- 600 possibilités - , List.map derivPoly02 ( mix [ [-9,-7,-5,-3], [-8,-6,-4,-2], [2,4,6,8], List.range -2 -1 ++ List.range 1 2, List.range -12 -11 ] ) -- 512 possibilités - , List.map primitLn01 ( mix [ List.range -9 -2 ++ List.range 2 9, List.range -9 -2 ++ List.range 2 9 ] ) -- 256 possibilités OK - , List.map dl01 ( mix [ [-5,-3,-1,1,3,5], [-6,-4,-2,2,4,6], [1,2,3], [-3,-2,-1,1,2,3] ] ) -- 648 possibilités OK - , List.map dl02 ( mix [ [-5,-4,-3,-2,-1,1,2,3,4,5], [0], [-1,-2,-3,-4,-5], [-3,-2,-1,1,2,3] ] ) -- 300 possibilités (toutes les questions en double because import pourri) - , List.map dl03 ( mix [ [0], [-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9], [0], [1,2,3,4,5,6,7,8,9] ] ) -- 162 possibilités OK - , List.map dl04 ( mix [ [-5,-3,-1,1,3,5], [-6,-4,-2,2,4,6], [0], [-9,-8,-7,-6,-5,-4,-3,-2,-1] ] ) --324 possibilités Ok - , List.concat <| List.map ( mapTwist [3,5,9] ) ( List.map dl05 ( mix [ [0], [2,4,7,8,11,13,16,17], [2,4,7,8,11,13,16,17] ] ) ) -- 192 possibilités OK - :: d3 -- 512 possibilités OK - :: ( List.map primitPoly01 <| mix [ List.range -3 -2 ++ List.range 2 3, List.range -3 -2 ++ List.range 2 3, List.range -3 -2 ++ List.range 2 3, List.range -3 -2 ++ List.range 2 3 ] ) -- 256 possibilités OK --- mix [ [1,2] , [3,4] , [5,6] ] == [ [1,3,5] , [1,3,6] , [1,4,5] , [1,4,6] , [2,3,5] , ... ] -mix lls = - case lls of - [] -> [] - [] :: llss -> [] - l :: [] -> List.map List.singleton l - (a :: ls) :: llss -> ( List.map ( (::) a ) ( mix llss ) ) ++ mix ( ls :: llss ) - -} - -text chaine = - S.lines chaine - |> L.map (p [] << L.singleton << Html.text) - |> p [] - - -{- -██████ █████ ██████ ███████ ███████ ██████ ███████ ██ ██ ██ ███████ ████████ -██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -██████ ███████ ██████ ███████ █████ ██████ ███████ ██ ██ ██ █████ ██ -██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -██ ██ ██ ██ ██ ███████ ███████ ██ ██ ███████ ██████ █████ ███████ ██ --} - -type alias Blocs = List Bloc - -type Bloc = - Sujet (List Bloc) - | VariableAremplacer Aremplacer Blocs - | Entete Macro Blocs - -- | ProblèmeOuvert NombreDeLigne TexteVariable - | QCM Macro Propositions - | VraiFaux Propositions - -type alias Propositions = List Proposition - -type Proposition = - Vrai Macro - | Faux Macro - -type alias NombreDeLigne = Int - -{-- -voirBlocsParse blocsPotentiel = - case P.run (withIndent -1 blocs) blocsPotentiel of - Ok sjt -> voirBlocs sjt - Err erreurs -> deadEndsToStringBis erreurs ---} - -voirBlocsParseAleatoire blocsPotentiel = - case P.run (withIndent -1 blocs) blocsPotentiel of - Ok sjt -> Random.map quizScanVoirBlocs <| blocsAleatoires sjt - Err erreurs -> Random.constant <| deadEndsToStringBis erreurs - -deadEndsToStringBis errs = - errs - |> List.map voirErreur - |> String.concat - |> (++) "Il y a des problèmes aux endroits suivants :\n" - -voirErreur err = - "Ligne : " ++ String.fromInt err.row - ++ " | Colonne : " ++ String.fromInt err.col - -{-- -voirBlocs = S.join "\n" << L.map voirBloc - -voirBloc prblm = - -- Debug.log "voirBloc " <| - case prblm of - Entete mcr sjt -> - voirMacro mcr - ++ "\n" - ++ voirBlocs sjt - VraiFaux prps -> - let - f prp = - case prp of - Vrai mcr -> voirMacro mcr - Faux mcr -> voirMacro mcr - in - S.join "\n" <| L.map f prps - VariableAremplacer ar sjt -> "" ++ voirBlocs sjt ---} - -sujet : Parser Blocs -sujet = - succeed (L.singleton << Sujet) - |= blocs - -blocs : Parser Blocs -blocs = - let - problemes prblms = - let - boucle = - -- Debug.log "Boucle sur un bloc (bis) " <| - succeed ( \prblm -> Loop (prblm :: prblms) ) - |= bloc - fin = - map (\_ -> Done (List.reverse prblms)) - suite col_ind = - oneOf - [ succeed () - |. end - |> fin - , if Tuple.first col_ind > Tuple.second col_ind then -- if col > ind - boucle -- |> Debug.log "Boucle sur un bloc " - else - succeed () - |> fin - ] - -- |> Debug.log ( "Choix de l'embrachement dans la boucle (position " ++ S.fromInt (Tuple.first col_ind) ++ "x" ++ S.fromInt (Tuple.second col_ind) ++ ")" ) - in - succeed Tuple.pair - |. spaces - |= getCol - |= getIndent - |> andThen suite - in - loop [] problemes - -bloc : Parser Bloc -bloc = - let - suite = - flip withIndent - <| oneOf - [ vraiFaux - , qcm - , backtrackable variableAremplacer - , entete ] - in - getCol - |> andThen suite - -flip f a b = f b a - -reserve = Set.fromList - [ "qcm" - , "vrfx" - , "var" - ] - -sousBlocs = - let - suite col_ind = - if Tuple.first col_ind > Tuple.second col_ind then -- if col > ind - withIndent (Tuple.first col_ind) ( lazy (\_ -> blocs) ) -- Aucune idée de l'effet du lazy, ça marche sans... - else - succeed [] - in - succeed Tuple.pair - |. spaces - |= getCol - |= getIndent - |> andThen suite - -entete : Parser Bloc -entete = - -- Debug.log "entete " <| - succeed Entete - |= macro - |= blocs -- sousBlocs - -vraiFaux = - -- Debug.log "vraiFaux " <| - succeed VraiFaux - |. keyword "vrfx" - |= propositions - -qcm = - -- Debug.log "vraiFaux " <| - succeed QCM - |. keyword "qcm" - |. espaces - |= macro - |= propositions - -propositions = - let - suiteBis prps = - let - boucle = - oneOf - [ succeed ( \mcr -> Loop ( Vrai mcr :: prps ) ) - |. symbol "+" - |= macro - , succeed ( \mcr -> Loop ( Faux mcr :: prps ) ) - |. symbol "-" - |= macro - ] - fin = - map (\_ -> Done prps) - suite col_ind = - oneOf - [ succeed () - |. end - |> fin - , if Tuple.first col_ind > Tuple.second col_ind then -- if col > ind - boucle - else - succeed () - |> fin - ] - in - succeed Tuple.pair - |. spaces - |= getCol - |= getIndent - |> andThen suite - in - loop [] suiteBis - - -{- -██████ █████ ██████ ███████ ███████ ██████ ███ ███ █████ ██████ ██████ ██████ -██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ -██████ ███████ ██████ ███████ █████ ██████ ██ ████ ██ ███████ ██ ██████ ██ ██ -██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -██ ██ ██ ██ ██ ███████ ███████ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██████ --} - -type TexteVariable - = Texte String - | Variable String - -type alias Macro - = List TexteVariable - -voirMacro = S.concat << L.map voirTexteVariable - -voirTexteVariable txtvar = - case txtvar of - Texte txt -> txt - Variable var -> - let - expressionParseePotentielle = PM.parseMaths var - in - case expressionParseePotentielle of - Err erreur -> "L'expression est mal formée." - Ok expressionParsee -> - case Maybe.map F.teX <| PM.evaluer <| expressionParsee of - Just a -> a - Nothing -> "Les puissances non-entières ne sont pas acceptées." - -texteSansVariables : Parser TexteVariable -texteSansVariables = - let - condition caractere = caractere /= '#' && caractere /= '\n' - in - succeed Texte - |= P.getChompedString ( - succeed () - |. P.chompIf condition - |. P.chompWhile condition - - ) - -expressionVariable : Parser TexteVariable -expressionVariable - = succeed Variable - |. symbol "#" - |= P.getChompedString ( P.chompUntil "#" ) - |. symbol "#" - -macro : Parser Macro -macro = - let - suite ls = - P.oneOf - [ succeed (\l -> P.Loop (l :: ls)) - |= P.oneOf - [ expressionVariable - , texteSansVariables - , backtrackable retourAlaLigne - ] - , succeed () - |> P.map (\_ -> P.Done (List.reverse ls)) - ] - in - P.loop [] suite - -retourAlaLigne = - let - suite ind = - succeed (Texte "\n") - |. token "\n" - |. token (S.repeat (ind - 1) " ") - in - getIndent - |> andThen suite - - -{- - ██████ █████ ██████ ███████ ███████ ██████ ██ ██ █████ ██████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██████ ███████ ██████ ███████ █████ ██████ ██ ██ ███████ ██████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██ ██ ██ ███████ ███████ ██ ██ ████ ██ ██ ██ ██ --} - -type alias Variables = List Aremplacer - -type alias Aremplacer = - { var : String - , vals : List String - } - -parserAremplacer variables = - case P.run aRemplacer variables of - Ok ars -> ars - Err _ -> Aremplacer "" [] - -espaces = - chompWhile <| (==) ' ' - -variableAremplacer : Parser Bloc -variableAremplacer = - -- Debug.log "variableAremplacer " <| - succeed VariableAremplacer - |= aRemplacer - |= blocs -- sousBlocs - -aRemplacer : Parser Aremplacer -aRemplacer = - succeed ( \x y -> Aremplacer x (L.map (F.raw << PM.evaluerBis) y) ) - |. espaces - |= variable - { start = Char.isAlpha - , inner = Char.isAlpha - , reserved = reserve - } - |. espaces - |. symbol ":" - |= sequence - { start = "" - , separator = "," - , end = "" - , spaces = espaces - , item = PM.expr - , trailing = P.Optional - } - -{- -███████ ██ ████████ █████ ██ ███████ █████ ████████ ██████ ██ ██████ ███████ -██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -███████ ██ ██ ███████ ██ █████ ███████ ██ ██ ██ ██ ██████ █████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ -███████ █████ ██ ██ ██ ███████ ███████ ██ ██ ██ ██████ ██ ██ ██ ███████ --} - -sujetsAleatoires : Blocs -> Random.Generator Blocs -sujetsAleatoires sjt = - blocsAleatoires sjt - |> Random.list 89 - |> Random.map L.concat - -blocsAleatoires : Blocs -> Random.Generator Blocs -blocsAleatoires sjt = - Random.map L.concat - <| Random.Extra.sequence - <| L.map blocAleatoire sjt - -blocAleatoire : Bloc -> Random.Generator Blocs -blocAleatoire prblm = - case prblm of - Sujet blcs -> - Random.map (L.singleton << Sujet) (blocsAleatoires blcs) - VariableAremplacer ar sjt -> - let - vrbl = ar.var - vlr = valeurAleatoire "" ar.vals - f sj vl = remplacerLaVariableDansLesBlocsAleatoires vrbl vl sj - in - {-- - Debug.log - ( "blocAleatoire, branche VariableAremplacer, variable : " - ++ vrbl ++ " " - ) <| - --} - Random.andThen (f sjt) vlr - Entete mcr sjt -> - Random.map (L.singleton << Entete mcr) (blocsAleatoires sjt) - VraiFaux prps -> - Random.map - (L.singleton << VraiFaux << L.singleton) - ( valeurAleatoire ( Vrai [ Texte "Le prof de maths est le meilleur." ] ) prps ) - QCM mcr prps -> - Random.map - (L.singleton << QCM mcr) - (Random.List.shuffle prps ) - -{-| Permet de prendre un élément aléatoire dans une liste - avec une valeur par défaut si la liste est vide. --} -valeurAleatoire : a -> List a -> Random.Generator a -valeurAleatoire f fs = - case fs of - [] -> - Random.constant f - ff :: fss -> - Random.uniform ff fss - -remplacerLaVariableDansLeBlocAleatoire : - String -> String -> Bloc -> Random.Generator Blocs -remplacerLaVariableDansLeBlocAleatoire vrbl vlr prblm = - case prblm of - Sujet blcs -> - remplacerLaVariableDansLesBlocsAleatoires vrbl vlr blcs - VariableAremplacer ar sjt -> - blocAleatoire (VariableAremplacer ar sjt) - |> Random.andThen (remplacerLaVariableDansLesBlocsAleatoires vrbl vlr) - Entete mcr sjt -> - Random.map L.singleton - <| Random.map2 Entete - ( Random.constant <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr ) - ( remplacerLaVariableDansLesBlocsAleatoires vrbl vlr sjt ) - QCM mcr prps -> - Random.map L.singleton - <| Random.map2 QCM - ( Random.constant <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr ) - ( Random.List.shuffle - <| L.map (remplacerLaVariableParLaValeurDansLaProposition vrbl vlr) prps - ) - VraiFaux prps -> - Random.map - ( L.singleton - << VraiFaux - << L.singleton - << remplacerLaVariableParLaValeurDansLaProposition vrbl vlr - ) - <| valeurAleatoire ( Vrai [ Texte "Le prof de maths est le meilleur." ] ) prps - -remplacerLaVariableDansLesBlocsAleatoires : - String -> String -> Blocs -> Random.Generator Blocs -remplacerLaVariableDansLesBlocsAleatoires vrbl vlr sjt = - Random.map L.concat - <| Random.Extra.sequence - <| L.map (remplacerLaVariableDansLeBlocAleatoire vrbl vlr) sjt - -remplacerLaVariableParLaValeurDansLaProposition vrbl vlr prp = - case prp of - Vrai mcr -> Vrai <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr - Faux mcr -> Faux <| remplacerLaVariableParLaValeurDansLaMacro vrbl vlr mcr - - -{- - ██████ ██ ██ ██ ███████ ███████ ██████ █████ ███ ██ - ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ████ ██ - ██ ██ ██ ██ ██ ███ ███████ ██ ███████ ██ ██ ██ - ██ ▄▄ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ - ██████ ██████ ██ ███████ ███████ ██████ ██ ██ ██ ████ - ▀▀ --} - -quizScanVoirBlocs : Blocs -> String -quizScanVoirBlocs blcs = - S.join "\n" <| L.map quizScanVoirBloc blcs - -quizScanVoirBloc prblm = - case prblm of - Sujet blcs -> - "\n\\begin{Sujet}\n" - ++ quizScanVoirBlocs blcs - ++ "\n\\end{Sujet}" - Entete mcr sjt -> - -- "\n \\begin{itemize}\n \\item " - voirMacro mcr - ++ "\n" - ++ quizScanVoirBlocs sjt - -- ++ " \\end{itemize}" - QCM mcr prps -> - let - f prp = - case prp of - Vrai mc -> - " \\Vrai{" ++ voirMacro mc ++ "}" - Faux mc -> - " \\Faux{" ++ voirMacro mc ++ "}" - in - "\n \\begin{QCM}\n" - ++ voirMacro mcr - ++ "\n \\begin{enumerate}\n" - ++ ( S.join "\n" <| L.map f prps ) - ++ "\n \\end{enumerate}\n \\end{QCM}" - VraiFaux prps -> - let - f prp = - case prp of - Vrai mc -> - "\n \\begin{VraiFaux}\n \\Vrai{" ++ voirMacro mc ++ "}\n \\end{VraiFaux}" - Faux mc -> - "\n \\begin{VraiFaux}\n \\Faux{" ++ voirMacro mc ++ "}\n \\end{VraiFaux}" - in - S.concat <| L.map f prps - VariableAremplacer ar sjt -> - "" ++ quizScanVoirBlocs sjt - - - -{- - ███ ███ ██ ██ ██ ███████ ██ ██ ██████ - ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ████ ██ ██ ███ █████ ██ ██ ██████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ██ ██ ██ ██ ██ ███████ ██████ ██ ██ --} - -{-- -remplacer : String -> String -> List String -remplacer variables question = - let - ars = - S.lines variables - |> L.map parserAremplacer - mcr = - parserQuestion question - in - remplacerLesVariablesDansLaMacro ars mcr - -remplacerLesVariablesDansLaMacro : List Aremplacer -> Macro -> List String -remplacerLesVariablesDansLaMacro ars mcr = - remplacerLesVariablesDansLaMacroBis ars [mcr] - |> L.map voirMacro - -remplacerLesVariablesDansLaMacroBis : List Aremplacer -> List Macro -> List Macro -remplacerLesVariablesDansLaMacroBis ars macros = - case ars of - [] -> macros - ar :: arss -> - L.map (remplacerLaVariableDansLaMacro ar) macros - |> L.concat - |> remplacerLesVariablesDansLaMacroBis arss - -remplacerLaVariableDansLaMacro : Aremplacer -> Macro -> List Macro -remplacerLaVariableDansLaMacro ar mcr = - let - f val = remplacerLaVariableParLaValeurDansLaMacro ar.var val mcr - in - L.map f ar.vals ---} - -remplacerLaVariableParLaValeurDansLaMacro : String -> String -> Macro -> Macro -remplacerLaVariableParLaValeurDansLaMacro var val mcr = - L.map (remplacerLaVariableParLaValeurDansLeTexteVariable var val) mcr - -remplacerLaVariableParLaValeurDansLeTexteVariable var val tv = - case tv of - Texte chaine -> Texte chaine - Variable chaine -> Variable <| S.replace var val chaine ---} - - -{- - - ███████ ██ ██ ██████ ██████ ███████ ███████ ███████ ██ ██████ ███ ██ ███████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ - █████ ███ ██████ ██████ █████ ███████ ███████ ██ ██ ██ ██ ██ ██ ███████ - ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ - ███████ ██ ██ ██ ██ ██ ███████ ███████ ███████ ██ ██████ ██ ████ ███████ - - - --} - -monome a n = - if a == 0 then "" - else if n == 0 then ( String.fromInt a ) - else if (n,a) == (1,1) then "x" - else if (n,a) == (1,-1) then "-x" - else if n == 1 then ( String.fromInt a ) ++ "x" - else if a == 1 then "x^{" ++ ( String.fromInt n ) ++ "}" - else if a == -1 then "-x^{" ++ ( String.fromInt n ) ++ "}" - else ( String.fromInt a ) ++ "x^{" ++ ( String.fromInt n ) ++ "}" - -poly a_ks = - if a_ks == [] then "0" - else polyBis a_ks ( List.length a_ks - 1 ) - -polyBis a_ks n = - case a_ks of - [] -> "" - a_n :: a_kss -> - if a_n == 0 then polyBis a_kss ( n - 1 ) - else ( monome a_n n ) ++ ( polyGen a_kss ( n - 1 ) ) - -polyGen a_ks n = - case a_ks of - [] -> "" - a_i :: a_is -> - if a_i <= 0 then ( monome a_i n ) ++ ( polyGen a_is ( n - 1 ) ) - else "+" ++ ( monome a_i n ) ++ ( polyGen a_is ( n - 1 ) ) - -polyD a_ks = polyDbis a_ks ( List.length a_ks - 1 ) - -polyDbis a_ks n = - case a_ks of - [] -> [] - a_0 :: [] -> [] - a_k :: a_kss -> ( n*a_k ) :: polyDbis a_kss ( n - 1 ) - -dl a_ks = - if a_ks == [] then "0" - else dlBis a_ks 0 - -dlBis a_ks n = - case a_ks of - [] -> "" - premierCoef :: suite -> - if premierCoef == 0 then dlBis suite ( n + 1 ) - else ( monome premierCoef n ) ++ ( dlGen suite ( n + 1 ) ) - -dlGen a_ks n = - case a_ks of - [] -> "" - a_i :: a_is -> - if a_i <= 0 then ( monome a_i n ) ++ ( dlGen a_is ( n + 1 ) ) - else "+" ++ ( monome a_i n ) ++ ( dlGen a_is ( n + 1 ) ) - - -{- - ██████ ██████ ███ ███ - ██ ██ ██ ████ ████ - ██ ██ ██ ██ ████ ██ - ██ ▄▄ ██ ██ ██ ██ ██ - ██████ ██████ ██ ██ - ▀▀ --} - - - -mathTeX a = "$" ++ a ++ "$" - -fonction a = "x\\mapsto " ++ a - -affineExp a b c - = if (a,b) == (0,0) then "0" - else if (a,c) == (0,1) then String.fromInt b ++ "e^x" - else if a == 0 then String.fromInt b ++ "e^{" ++ (String.fromInt c) ++ "x}" - else if (a,b,c) == (1,0,1) then "xe^x" - else if (b,c) == (0,1) then (String.fromInt a) ++ "x" ++ "e^x" - else if b == 0 then (String.fromInt a) ++ "x" ++ "e^{" ++ (String.fromInt c) ++ "x}" - else if c == 1 then "\\left(" ++ (String.fromInt a) ++ "x+" ++ (String.fromInt b) ++ "\\right)e^x" - else "\\left(" ++ (String.fromInt a) ++ "x+" ++ (String.fromInt b) ++ "\\right)e^{" ++ (String.fromInt c) ++ "x}" - -derivExp01 a b c = - let - f aa bb cc = mathTeX ( fonction ( affineExp aa bb cc ) ) - vr aa bb cc = p [] [ text ( "+" ++ ( f aa bb cc) ) ] - fx aa bb cc = p [] [ text ( "-" ++ ( f aa bb cc) ) ] - in - div [] - [ p [] [ text ("Donner la dérivée de la fonction " ++ f a b c) ] - , vr (a*c) (a+b*c) c - , fx (a+b) a c - , fx (a+b) a (-c) - , fx (a+b*c) (a*c) c - , fx (a-b*c) (a*c) (-c) - , fx (a-b*c) (a*c) c - , fx a 0 c - , fx (a*c) 0 (-c) - , fx a 0 1 - , fx (a*c) 0 1 - {-- - , p [] [ text ("----") ] - , p [] [ text ("Avant toute chose, il faut bien voir que $\\left(" ++ (String.fromInt a) ++ "x+" ++ (String.fromInt b) ++ "\\right)e^{" ++ (String.fromInt c) ++ "x}$ est de la forme $uv$ avec $u=ax+b$ et $v=e^{cx}$.") ], - , p [] [ text ("Ensuite, il faut savoir que la dérivée de $uv$ est donnée par $u'v+uv'$, et que la dérivée de $e^{u}$ est donnée par $e^{u}\\cdot u'$, ce qui dans notre cas nous donne que la dérivée de $e^{" ++ (String.fromInt c) ++ "x}$ est donnée par $" ++ (String.fromInt c) ++ "e^{" ++ (String.fromInt c) ++ "x}$.") ] - , p [] [ text ("Nous avons donc que la dérivée de la fonction est :") ] - , p [] [ text ("$\\begin{array}{rl} x\\mapsto & " ++ (String.fromInt (a)) ++ "e^{" ++ (String.fromInt c) ++ "x}+\\left(" ++ (String.fromInt (a)) ++ "x+" ++ (String.fromInt (b)) ++ "\\right)ce^{" ++ (String.fromInt (c)) ++ "x}\\\\& =" ++ (String.fromInt (a)) ++ "e^{" ++ (String.fromInt (c)) ++ "x}+\\left(" ++ (String.fromInt (a*c)) ++ "x+" ++ (String.fromInt (b*c)) ++ "\\right)e^{" ++ (String.fromInt (c)) ++ "x}\\\\ & =\\left(" ++ (String.fromInt (a)) ++ "+" ++ (String.fromInt (a*c)) ++ "x+" ++ (String.fromInt (b*c)) ++ "\\right)e^{" ++ (String.fromInt (c)) ++ "x}\\\\ & =\\left(" ++ (String.fromInt (a+b*c)) ++ "+" ++ (String.fromInt (a*c)) ++ "x\\right)e^{" ++ (String.fromInt (c)) ++ "x} \\end{array}$") ] - --} - , p [] [ text ("==== Dérivées, Exponentielle, derivExp01") ] - ] - - - --- Des DL - - - -dl01 a_k = - let - vr texte = p [] [ text ( "+" ++ texte ) ] - fx texte = p [] [ text ( "-" ++ texte ) ] - in - div [] - [ p [] [ text ( "On considère une fonction $f$ dont le développement limité à l'ordre 3 au voisinage de $0$ est " ++ mathTeX ( dl a_k ) ++ "." ) ] - , p [] [ text ( "On note $C$ la courbe représentative de $f$ et $T_0$ sa tangente en son point d'abscisse $0$." ) ] - , p [] [ text ( "Cocher la ou les réponses correctes." ) ] - , vr <| "L'équation de $T_0$ est $y=" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $y=" ++ poly ( List.take 2 a_k ) ++"$" -- ATTENTION à éviter les cas où a_0 = a_1 - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.take 2 a_k ) ++"$" - , vr "$C$ est au-dessus de $T_0$." - , fx "$C$ est au-dessous de $T_0$." - , fx "$C$ est au-dessous puis au-dessus de $T_0$." - , fx "$C$ est au-dessus puis au-dessous de $T_0$." - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Développements limités, Tangentes, dl01") ] - ] - - -dl02 a_k = - let - vr texte = p [] [ text ( "+" ++ texte ) ] - fx texte = p [] [ text ( "-" ++ texte ) ] - in - div [] - [ p [] [ text ( "On considère une fonction $f$ dont le développement limité à l'ordre 3 au voisinage de $0$ est " ++ mathTeX ( dl a_k ) ++ "." ) ] - , p [] [ text ( "On note $C$ la courbe représentative de $f$ et $T_0$ sa tangente en son point d'abscisse $0$." ) ] - , p [] [ text ( "Cocher la ou les réponses correctes." ) ] - , vr <| "L'équation de $T_0$ est $y=" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $y=" ++ poly ( List.reverse <| List.take 3 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $y=" ++ poly ( List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.reverse <| List.take 3 a_k ) ++"x$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.take 2 a_k ) ++"$" - , fx "$C$ est au-dessus de $T_0$." - , vr "$C$ est au-dessous de $T_0$." - , fx "$C$ est au-dessous puis au-dessus de $T_0$." - , fx "$C$ est au-dessus puis au-dessous de $T_0$." - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Développements limités, Tangentes, dl02") ] - ] - - -dl03 a_k = - let - vr texte = p [] [ text ( "+" ++ texte ) ] - fx texte = p [] [ text ( "-" ++ texte ) ] - in - div [] - [ p [] [ text ( "On considère une fonction $f$ dont le développement limité à l'ordre 3 au voisinage de $0$ est " ++ mathTeX ( dl a_k ) ++ "." ) ] - , p [] [ text ( "On note $C$ la courbe représentative de $f$ et $T_0$ sa tangente en son point d'abscisse $0$." ) ] - , p [] [ text ( "Cocher la ou les réponses correctes." ) ] - , vr <| "L'équation de $T_0$ est $y=" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $y=" ++ poly ( List.take 2 a_k ) ++"$" -- ATTENTION à éviter les cas où a_0 = a_1 - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.take 2 a_k ) ++"$" - , fx "$C$ est au-dessus de $T_0$." - , fx "$C$ est au-dessous de $T_0$." - , vr "$C$ est au-dessous puis au-dessus de $T_0$." - , fx "$C$ est au-dessus puis au-dessous de $T_0$." - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Développements limités, Tangentes, dl03") ] - ] - - -dl04 a_k = - let - vr texte = p [] [ text ( "+" ++ texte ) ] - fx texte = p [] [ text ( "-" ++ texte ) ] - in - div [] - [ p [] [ text ( "On considère une fonction $f$ dont le développement limité à l'ordre 3 au voisinage de $0$ est " ++ mathTeX ( dl a_k ) ++ "." ) ] - , p [] [ text ( "On note $C$ la courbe représentative de $f$ et $T_0$ sa tangente en son point d'abscisse $0$." ) ] - , p [] [ text ( "Cocher la ou les réponses correctes." ) ] - , vr <| "L'équation de $T_0$ est $y=" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $y=" ++ poly ( List.take 2 a_k ) ++"$" -- ATTENTION à éviter les cas où a_0 = a_1 - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.reverse <| List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $f\\left(x\\right)\\approx" ++ poly ( List.take 2 a_k ) ++"$" - , fx <| "L'équation de $T_0$ est $" ++ poly ( List.take 2 a_k ) ++"$" - , fx "$C$ est au-dessus de $T_0$." - , fx "$C$ est au-dessous de $T_0$." - , fx "$C$ est au-dessous puis au-dessus de $T_0$." - , vr "$C$ est au-dessus puis au-dessous de $T_0$." - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Développements limités, Tangentes, dl04") ] - ] - - -dl05 a_k k = -- À n'utiliser qu'avec a_0 = 0 !!! - let - coefLin = - case a_k of - [] -> 0 - a_0 :: [] -> 0 - a_0 :: a_1 :: a_ks -> a_1 - coefQuad = - case a_k of - [] -> 0 - a_0 :: [] -> 0 - a_0 :: a_1 :: [] -> 0 - a_0 :: a_1 :: a_2 :: a_ks -> a_2 - vr a b = p [] [ text <| "+$\\frac{" ++ String.fromInt a ++ "}{" ++ String.fromInt b ++ "}$" ] - ffx a b = p [] [ text <| "-$\\frac{" ++ String.fromInt a ++ "}{" ++ String.fromInt b ++ "}$" ] - fx a = p [] [ text <| "-$" ++ String.fromInt a ++ "$" ] - in - div [] - [ p [] [ text ( "On considère une fonction $f$ dont le développement limité à l'ordre 2 au voisinage de $0$ est " ++ mathTeX ( dl a_k ) ++ "." ) ] - , p [] [ text <| "Que vaut $\\lim\\limits_{x\\to0}\\frac{f\\left(x\\right)}{" ++ (String.fromInt k) ++ "x}$" ] - , vr coefLin k - , ffx 1 coefLin - , ffx 1 coefQuad - , ffx 1 k - , ffx coefQuad k - , ffx k coefQuad - , fx coefLin - , fx coefQuad - , fx k - , fx 1 - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Développements limités, Tangentes, dl05") ] - ] - - -mapTwist a b = List.map b a - -entiers = List.range 2 9 - -d1 = List.map derivExp01 entiers - -d2 = List.concat ( List.map (mapTwist entiers) d1 ) - -d3 = List.concat ( List.map (mapTwist entiers) d2 ) - -derivPoly01 param = -- on donne a pair et positif, les deux racines x_1 < x_2, d, et m > x_2 - case param of - [] -> div [] [] - a :: [] -> div [] [] - a :: b :: [] -> div [] [] - a :: b :: c :: [] -> div [] [] - a :: b :: c :: d :: [] -> div [] [] - a :: b :: c :: d :: e :: a_ks -> derivPoly01Bis a b c d e - -derivPoly01Bis a x_1 x_2 d m = - let - b = 0 - 3*a*(x_1 + x_2)//2 - c = 3*a*x_1*x_2 - a_k = [a,b,c,d] - vr texte = p [] [ text ( "+" ++ texte ) ] - fx texte = p [] [ text ( "-" ++ texte ) ] - in - div [] - [ p [] [ text ( "On considère la fonction $f:x\\mapsto " ++ ( poly a_k ) ++ "$." ) ] - , p [] [ text ( "Cocher la ou les réponses correctes." ) ] - , vr <| "La dérivée de $f$ est la fonction $f\\prime:x\\mapsto " ++ ( poly <| polyD a_k ) ++ "$." - , fx <| "La dérivée de $f$ est la fonction $f\\prime:x\\mapsto " ++ ( poly [3*a, 2*b, c + d] ) ++ "$." - , fx <| "la fonction $f$ est croissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";" ++ String.fromInt x_2 ++ "\\right]$" - , vr <| "la fonction $f$ est décroissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";" ++ String.fromInt x_2 ++ "\\right]$" - , fx <| "la fonction $f$ est décroissante sur l'intervalle $\\left[" ++ String.fromInt m ++ ";+\\infty\\right[$" - , vr <| "la fonction $f$ est croissante sur l'intervalle $\\left[" ++ String.fromInt m ++ ";+\\infty\\right[$" - , fx <| "la fonction $f$ est croissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";+\\infty\\right[$" - , fx <| "la fonction $f$ est décroissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";+\\infty\\right[$" - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Dérivée, Polynômes, derivPoly01") ] - ] - -derivPoly02 param = -- on donne a impair et négatif, les deux racines x_1 < x_2 pairs distincs, d, et m < x_1 - case param of - [] -> div [] [] - a :: [] -> div [] [] - a :: b :: [] -> div [] [] - a :: b :: c :: [] -> div [] [] - a :: b :: c :: d :: [] -> div [] [] - a :: b :: c :: d :: e :: a_ks -> derivPoly02Bis a b c d e - -derivPoly02Bis a x_1 x_2 d m = - let - b = 0 - 3*a*(x_1 + x_2)//2 - c = 3*a*x_1*x_2 - a_k = [a,b,c,d] - vr texte = p [] [ text ( "+" ++ texte ) ] - fx texte = p [] [ text ( "-" ++ texte ) ] - in - div [] - [ p [] [ text ( "On considère la fonction $f:x\\mapsto " ++ ( poly a_k ) ++ "$." ) ] - , p [] [ text ( "Cocher la ou les réponses correctes." ) ] - , vr <| "La dérivée de $f$ est la fonction $f\\prime:x\\mapsto " ++ ( poly <| polyD a_k ) ++ "$." - , fx <| "La dérivée de $f$ est la fonction $f\\prime:x\\mapsto " ++ ( poly [3*a, 2*b, c + d] ) ++ "$." - , vr <| "la fonction $f$ est croissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";" ++ String.fromInt x_2 ++ "\\right]$" - , fx <| "la fonction $f$ est décroissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";" ++ String.fromInt x_2 ++ "\\right]$" - , vr <| "la fonction $f$ est décroissante sur l'intervalle $\\left]-\\infty;" ++ String.fromInt m ++ "\\right]$" - , fx <| "la fonction $f$ est croissante sur l'intervalle $\\left]-\\infty;" ++ String.fromInt m ++ "\\right[$" - , fx <| "la fonction $f$ est croissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";+\\infty\\right[$" - , fx <| "la fonction $f$ est décroissante sur l'intervalle $\\left[" ++ String.fromInt x_1 ++ ";+\\infty\\right[$" - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Dérivée, Polynômes, derivPoly02") ] - ] - - -equaDiff01 a = -- a négatif - let - f aa = mathTeX ( fonction ( aa ) ) - vr aa = p [] [ text ( "+" ++ ( f aa ) ) ] - fx aa = p [] [ text ( "-" ++ ( f aa ) ) ] - in - div [] - [ p [] [ text <| "Parmi les fonctions ci-dessous, lesquelles sont des solutions de l'équation différentielle $y'=" ++ String.fromInt a ++ "y$ ?" ] - , vr <| String.fromInt ( a - 1 ) ++ "e^{" ++ String.fromInt a ++ "x}" - , vr <| String.fromInt ( a + 4 ) ++ "e^{" ++ String.fromInt a ++ "x}" - , vr <| String.fromInt a ++ "e^{" ++ String.fromInt a ++ "x}" - , fx <| String.fromInt a ++ "e^{" ++ String.fromInt (a-1) ++ "x}" - , fx <| String.fromInt ( a - 3 ) ++ "e^x" - , fx <| String.fromInt ( a + 7 ) ++ "e^x" ++ String.fromInt a - , fx <| String.fromInt a ++ "e^x" - , fx <| String.fromInt a ++ "e^x+" ++ String.fromInt ( a + 100) - , fx <| String.fromInt ( a - 1 ) ++ "e^x+" ++ String.fromInt ( a + 100) - , fx <| String.fromInt ( a - 8 ) ++ "e^{" ++ String.fromInt (a-1) ++ "x}" ++ String.fromInt a - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Équations différentielles, equaDiff01") ] - ] - -equaDiff02 param = - case param of - [] -> div [] [] - a :: [] -> div [] [] - a :: b :: c -> equaDiff02Bis a b - -equaDiff02Bis a b = -- a positif, b négatif, pas de simplification - let - f aa = mathTeX ( fonction ( aa ) ) - vr aa = p [] [ text ( "+" ++ ( f aa ) ) ] - fx aa = p [] [ text ( "-" ++ ( f aa ) ) ] - in - div [] - [ p [] [ text <| "Parmi les fonctions ci-dessous, lesquelles sont des solutions de l'équation différentielle $" ++ String.fromInt a ++"y'=" ++ String.fromInt b ++ "y$ ?" ] - , vr <| String.fromInt ( a - 17 ) ++ "e^{-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}x}" - , vr <| String.fromInt ( a + 23 ) ++ "e^{-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}x}" - , fx <| String.fromInt ( a + 3 ) ++ "e^{\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}x}" - , fx <| String.fromInt ( a - 17 ) ++ "e^{\\frac{" ++ String.fromInt a ++ "}{" ++ String.fromInt (0 - b) ++ "}x}" - , fx <| String.fromInt ( a + 23 ) ++ "e^{-\\frac{" ++ String.fromInt a ++ "}{" ++ String.fromInt (0 - b) ++ "}x}" - , fx <| String.fromInt a ++ "e^{" ++ String.fromInt b ++ "x}-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , fx <| String.fromInt a ++ "e^{" ++ String.fromInt b ++ "x}+\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , fx <| String.fromInt b ++ "e^{" ++ String.fromInt b ++ "x}-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , fx <| String.fromInt b ++ "e^{" ++ String.fromInt b ++ "x}+\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , fx <| "e^x+\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Équations différentielles, equaDiff02") ] - ] - -equaDiff03 param = - case param of - [] -> div [] [] - a :: [] -> div [] [] - a :: b :: c -> equaDiff03Bis a b - -equaDiff03Bis a b = -- a positif, b négatif, pas de simplification - let - f aa = mathTeX ( fonction ( aa ) ) - vr aa = p [] [ text ( "+" ++ ( f aa ) ) ] - fx aa = p [] [ text ( "-" ++ ( f aa ) ) ] - in - div [] - [ p [] [ text <| "Parmi les fonctions ci-dessous, lesquelles sont des solutions de l'équation différentielle $y'=" ++ String.fromInt a ++ "y" ++ String.fromInt b ++"$ ?" ] - , fx <| String.fromInt ( a - 17 ) ++ "e^{-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}x}" - , fx <| String.fromInt ( a + 23 ) ++ "e^{-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}x}" - , fx <| String.fromInt ( a + 3 ) ++ "e^{\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}x}" - , fx <| String.fromInt ( a - 17 ) ++ "e^{\\frac{" ++ String.fromInt a ++ "}{" ++ String.fromInt (0 - b) ++ "}x}" - , fx <| String.fromInt ( a + 23 ) ++ "e^{-\\frac{" ++ String.fromInt a ++ "}{" ++ String.fromInt (0 - b) ++ "}x}" - , fx <| String.fromInt a ++ "e^{" ++ String.fromInt a ++ "x}-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , vr <| String.fromInt a ++ "e^{" ++ String.fromInt a ++ "x}+\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , fx <| String.fromInt b ++ "e^{" ++ String.fromInt a ++ "x}-\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , vr <| String.fromInt b ++ "e^{" ++ String.fromInt a ++ "x}+\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - , fx <| "e^x+\\frac{" ++ String.fromInt (0 - b) ++ "}{" ++ String.fromInt a ++ "}" - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Équations différentielles, equaDiff03") ] - ] - -primitLn01 a_k = - case a_k of - [] -> div [] [] - a :: [] -> div [] [] - a :: b :: c -> primitLn01Bis a b - -primitLn01Bis a b = - let - f aa = mathTeX ( fonction ( aa ) ) - vr aa = p [] [ text ( "+" ++ ( f aa ) ) ] - fx aa = p [] [ text ( "-" ++ ( f aa ) ) ] - axpb = poly [a,b] - in - div [] - [ p [] [ text <| "Parmi les fonctions ci-dessous, lesquelles sont des primitives de la fonction " ++ ( f <| "\\frac{" ++ String.fromInt a ++ "}{" ++ axpb ++ "}" ) ++ " ?" ] - , vr <| "\\ln\\left(" ++ axpb ++ "\\right)" - , vr <| "\\ln\\left(" ++ axpb ++ "\\right)+" ++ String.fromInt ( b + 30 ) - , vr <| "\\ln\\left(" ++ axpb ++ "\\right)" ++ String.fromInt ( a - 20) - , fx <| "\\frac{" ++ String.fromInt (a*a) ++ "}{\\left(" ++ axpb ++ "\\right)^2}" - , fx <| "\\frac{" ++ String.fromInt (a*a) ++ "}{" ++ axpb ++ "}" ++ String.fromInt ( b + 30 ) - , fx <| "\\frac{" ++ String.fromInt (0 - a*a) ++ "}{\\left(" ++ axpb ++ "\\right)^2}" - , fx <| "\\frac{" ++ String.fromInt (0 - a*a) ++ "}{" ++ axpb ++ "}+" ++ String.fromInt ( b + 30 ) - , fx <| "\\frac{" ++ String.fromInt (0 - a*a) ++ "}{" ++ axpb ++ "}" ++ String.fromInt ( a - 20) - , fx <| "\\frac{" ++ poly [a*a, a*b+a*a] ++ "}{\\left(" ++ axpb ++ "\\right)^2}" - , fx <| "\\frac{" ++ poly [a*a, a*b-a*a] ++ "}{\\left(" ++ axpb ++ "\\right)^2}" - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Primitives, Logarithme, primitLn01") ] - ] - -primitPoly01 a_k = - case a_k of - [] -> div [] [] - a :: [] -> div [] [] - a :: b :: [] -> div [] [] - a :: b :: c :: [] -> div [] [] - a :: b :: c :: d :: e -> primitPoly01Bis a b c d - -primitPoly01Bis a b c d = - let - pol = [a,b,c,d,0] - polD = polyD pol - polDD = polyD polD - f a_k = mathTeX ( fonction ( poly a_k ) ) - vr a_k = p [] [ text ( "+" ++ ( f a_k ) ) ] - fx a_k = p [] [ text ( "-" ++ ( f a_k ) ) ] - in - div [] - [ p [] [ text <| "Parmi les fonctions ci-dessous, lesquelles sont des primitives de la fonction " ++ ( f polD ) ++ " ?" ] - , vr <| List.map2 (+) pol [0,0,0,0,5] - , vr <| List.map2 (+) pol [0,0,0,0,-8] - , vr <| List.map2 (+) pol [0,0,0,0,8] - , fx <| List.map2 (+) polD [0,0,0,8] - , fx <| List.map2 (+) polD [0,0,0,-5] - , fx <| List.map2 (+) polD [0,0,0,-8] - , fx <| List.map2 (+) polDD [0,0,8] - , fx <| List.map2 (+) polDD [0,0,-5] - , fx <| List.map2 (+) polDD [0,0,-8] - {-- - , p [] [ text ("----") ] - --} - , p [] [ text ("==== Primitives, Polynômes, primitPoly01") ] - ] - - - -