Accueil › Forums › Programmation WIMS › Programmation d’exercices OEF › Bug canvasdraw et/ou drawinput
- Ce sujet contient 13 réponses, 2 participants et a été mis à jour pour la dernière fois par
jm.evers, le il y a 2 années et 11 mois.
-
AuteurMessages
-
-
7 juillet 2020 à 02:22 #5877
Christophe Barnier
Participant::Bonjour,
Cet exercice fonctionnait très bien mais il ne fonctionne plus… Je n’arrive pas à savoir ce qu’il se passe.\title{Arbre de probabilité à compléter} \language{fr} \range{-5..5} \author{Barnier Christophe} \email{barnierchr@gmail.com} \computeanswer{no} \format{html} \precision{10000} \text{liste=C,D,E,F,G,H,L,M,N,P,R,S,T} \text{listem=shuffle(\liste)} \text{A=\listem[1]} \text{B=\listem[2]} \real{pA=randint(1..99)/100} \real{pnA=1-\pA} \real{pBsA=randint(1..99)/100} p de B sachant A \real{pnBsA=1-\pBsA} \real{pBsnA=randint(1..99)/100} \real{pnBsnA=1-\pBsnA} \real{pAB=\pA*\pBsA} \real{pAnB=\pA*\pnBsA} \real{pnAB=\pnA*\pBsnA} \real{pnAnB=\pnA*\pnBsnA} \real{pB=\pAB+\pnAB} \real{pnB=1-\pB} \integer{round{ipAsB=\pAB/\pB*100}} \real{pAsB=\ipAsB/100} \real{pnAsB=1-pAsB} \integer{round{ipAsnB=\pAnB/\pnB*100}} \real{pAsnB=\ipAsnB/100} \real{pnAsnB=1-pAsnB} \text{tnA=wims(mathmlmath \overline{\A})} \text{tnB=wims(mathmlmath \overline{\B})} \text{tA=wims(mathmlmath \A)} \text{tB=wims(mathmlmath \B)} \text{tAeB=wims(mathmlmath \A \cap \B)} \text{tAenB=wims(mathmlmath \A \cap \overline{\B})} \text{tnAeB=wims(mathmlmath \overline{\A} \cap \B)} \text{tnAenB=wims(mathmlmath \overline{\A} \cap \overline{\B})} \text{dessinarbre= xrange 0,10 yrange -10,10 text black,0,-0.5,large,* arrow 0.3,0,2,4.5,10,black strokecolor red mathml 2.2,5,0,0,\tA text black,0.5,2.6,normal,\pA arrow 2.5,4.5,4.5,7,10,black strokecolor red mathml,4.7,7.4,0,0,\tB text black,3.2,6.5,normal,\pBsA arrow 2.5,4.5,4.5,2,10,black strokecolor red mathml 4.7,2.4,0,0,\tnB arrow 0.3,0,2,-4.5,10,black strokecolor red mathml,2.2,-4,0,0,\tnA arrow 2.5,-4.5,4.5,-7,10,black strokecolor red mathml,4.7,-6.8,0,0,\tnB arrow 2.5,-4.5,4.5,-2,10,black strokecolor red mathml,4.7,-1.5,0,0,\tB text black,3.2,-2.5,normal,\pBsnA } \text{dessinarbre2= xrange 0,10 yrange -10,10 text black,0,-0.5,large,* arrow 0.3,0,2,4.5,10,black strokecolor red mathml 2.2,5,0,0,\tA text black,0.5,2.6,normal,\pA arrow 2.5,4.5,4.5,7,10,black strokecolor red mathml,4.7,7.4,0,0,\tB strokecolor red mathml,5.7,7.4,0,0,\tAeB text black ,5.7,8,normal,issues text black ,7.7,8,normal,probabilités text black,3.2,6.5,normal,\pBsA arrow 2.5,4.5,4.5,2,10,black strokecolor red mathml 4.7,2.4,0,0,\tnB strokecolor red mathml 5.7,2.4,0,0,\tAenB text black,3.2,1.9,normal,\pnBsA arrow 0.3,0,2,-4.5,10,black strokecolor red mathml,2.2,-4,0,0,\tnA text black,0.5,-3.3,normal,\pnA arrow 2.5,-4.5,4.5,-7,10,black strokecolor red mathml,4.7,-6.8,0,0,\tnB strokecolor red mathml,5.7,-6.8,0,0,\tnAenB text black,3.2,-7.1,normal,\pnBsnA arrow 2.5,-4.5,4.5,-2,10,black strokecolor red mathml,4.7,-1.5,0,0,\tB strokecolor red mathml,5.7,-1.5,0,0,\tnAeB text black,3.2,-2.5,normal,\pBsnA } \text{dessinarbresol= xrange 0,10 yrange -10,10 text black,0,-0.5,large,* arrow 0.3,0,2,4.5,10,black strokecolor red mathml 2.2,5,0,0,\tA text black,0.5,2.6,normal,\pA arrow 2.5,4.5,4.5,7,10,black strokecolor red mathml,4.7,7.4,0,0,\tB strokecolor red mathml,5.7,7.4,0,0,\tAeB text black ,5.7,8,normal,issues text black ,7.7,8,normal,probabilités text black,3.2,6.5,normal,\pBsA arrow 2.5,4.5,4.5,2,10,black strokecolor red mathml 4.7,2.4,0,0,\tnB strokecolor red mathml 5.7,2.4,0,0,\tAenB text black,3.2,1.9,normal,\pnBsA arrow 0.3,0,2,-4.5,10,black strokecolor red mathml,2.2,-4,0,0,\tnA text black,0.5,-3.3,normal,\pnA arrow 2.5,-4.5,4.5,-7,10,black strokecolor red mathml,4.7,-6.8,0,0,\tnB strokecolor red mathml,5.7,-6.8,0,0,\tnAenB text black,3.2,-7.1,normal,\pnBsnA arrow 2.5,-4.5,4.5,-2,10,black strokecolor red mathml,4.7,-1.5,0,0,\tB strokecolor red mathml,5.7,-1.5,0,0,\tnAeB text black,3.2,-2.5,normal,\pBsnA strokecolor green mathml,7.7, 7.4,0,0,\pAB mathml,7.7, -1.5,0,0,\pnAB } \steps{r1, r2, r3 r4, r5 } \statement{ <p>On considère une expérience aléatoire, \(\A) et \(\B) sont deux événements.</p> <p> <b>Etape 1:</b> compléter l'arbre.</p> \if{\step=1}{ <div> \special{drawinput [\dessinarbre], 450 x 300, 1 r1,0.5 x -1 r2,2.75 x 3.5 r3,2.75 x -5.4 } </div> <div> </div> } \if{\step=2 and \sc_reply1 = 1 and \sc_reply2 = 1 and \sc_reply3 = 1}{ <div class="oui"> Trois bonnes réponses, très bien ! <hr /> </div> } \if{\step=2 and \sc_reply1 = 0 or \sc_reply2 = 0 or \sc_reply3 = 0}{ <div class="non"> Attention, vous vous êtes trompé, voici la règle qui s'applique pour compléter un arbre: <div class="propriete"> <p> <i><b>Règle 1:</b> Pour chaque noeud de l'arbre, la somme des probabilités doit être égale à 1.</i><p> <center>\(p\left(\A\right)+\p\left(\overline{\A}\right)=1) donc \(\p\left(\overline{\A}\right)=1-p\left(\A\right)=1-\pA=\pnA)</center> </div> <hr /> Faites la suite de l'exercice avec les bonnes valeurs. </div> } \if{\step=2}{ <p> <b>Etape 2:</b> Calcul de la probabilité des intersections</p> <div> \special{drawinput [\dessinarbre2], 450 x 300, 3 r4,7.7 x 7.4 r5,7.7 x -1.5 } </div> <div> </div> } } \feedback{\sc_reply4 = 0 or \sc_reply5 = 0}{ <div class="non"> Attention, vous vous êtes trompé, voici la règle qui s'applique pour calculer la probabilité d'une intersection d'événements: <div class="propriete"> <p> <i><b>Règle 2:</b> La probabilité de l’événement correspondant à un chemin de l’arbre est obtenue en multipliant les probabilités portées par ses branches..</i><p> <center>\(p(\A \cap \B)=p(\A)\times p_\A(\B)=\pA\times \pBsA =\pAB )</center> </div> </div> <b> solution </b> \canvasdraw{450,300}{\dessinarbresol} } \feedback{\sc_reply4 = 1 and \sc_reply5 = 1}{ <div class="oui"> Très bien, vos calculs sont juste. </div> <b> solution </b> \canvasdraw{450,300}{\dessinarbresol} } \hint{ <div class="propriete"> <p> <i><b>Règle 1:</b> Pour chaque noeud de l'arbre, la somme des probabilités doit être égale à 1.</i><p> <center>\(p\left(A\right)+\p\left(\overline{A}\right)=1)</center> <p> <i><b>Règle 2:</b> La probabilité de l’événement correspondant à un chemin de l’arbre est obtenue en multipliant les probabilités portées par ses branches..</i><p> <center>\(p(A \cap B)=p(A)\times p_A(B))</center> </div> } \answer{pnA}{\pnA}{type=default}{option=nonstop} \answer{pnBsA}{\pnBsA}{type=default}{option=nonstop} \answer{pnBsnA}{\pnBsnA}{type=default}{option=nonstop} \answer{pAB}{\pAB}{type=default} \answer{pnAB}{\pnAB}{type=default}
-
7 juillet 2020 à 07:39 #5878
jm.evers
Participant::Hi,
I don’t know what the problem is, but pay attention:the command mathml is changed…It is now simplymathml x,y,mathmlcode
And there is a probably simpler way of presenting TeX formatted typesetting using
the new commandlatex x,y,TeXcode
(please check if you are using a current version of canvasdraw)
Bernadette Perrin has created a great/large help page within createxo.
The rest of the exercise escapes my knowledge of the french language.
Please post a simpler example of your issue with canvasdraw -preferably in direct exec !
joke -
7 juillet 2020 à 11:26 #5881
Christophe Barnier
Participant -
7 juillet 2020 à 12:30 #5882
Christophe Barnier
Participant::Bonjour,
J’ai réduit le code pour cerner les bugs. j’ai deux bug:- le \overline{A} ne passe pas dans la fonction latex x,y,Texcod
il n’y a pas de barre sur le A à l’affichage. - Le dessin ne passe plus dans le drawinput
Merci de votre aide. Christophe
\title{Arbre de probabilité à compléter} \language{fr} \range{-5..5} \author{Barnier Christophe} \email{barnierchr@gmail.com} \computeanswer{no} \format{html} \precision{10000} \real{pA=randint(1..99)/100} \real{pnA=1-\pA} \real{pBsA=randint(1..99)/100} p de B sachant A \real{pnBsA=1-\pBsA} \real{pBsnA=randint(1..99)/100} \real{pnBsnA=1-\pBsnA} \real{pAB=\pA*\pBsA} \real{pAnB=\pA*\pnBsA} \real{pnAB=\pnA*\pBsnA} \real{pnAnB=\pnA*\pnBsnA} \real{pB=\pAB+\pnAB} \real{pnB=1-\pB} \integer{ipAsB=round{\pAB/\pB*100}} \real{pAsB=\ipAsB/100} \real{pnAsB=1-pAsB} \integer{ipAsnB=round{\pAnB/\pnB*100}} \real{pAsnB=\ipAsnB/100} \real{pnAsnB=1-pAsnB} \text{dessinarbre= xrange 0,10 yrange -10,10 text black,0,-0.5,large,* arrow 0.3,0,2,4.5,10,black strokecolor red latex 2.2,5,A text black,0.5,2.6,normal,\pA arrow 2.5,4.5,4.5,7,10,black strokecolor red latex,4.7,7.4,B text black,3.2,6.5,normal,\pBsA arrow 2.5,4.5,4.5,2,10,black strokecolor red latex 4.7,2.4,\overline{B} arrow 0.3,0,2,-4.5,10,black strokecolor red latex,2.2,-4,\overline{A} arrow 2.5,-4.5,4.5,-7,10,black strokecolor red latex,4.7,-6.8,\overline{B} arrow 2.5,-4.5,4.5,-2,10,black strokecolor red latex,4.7,-1.5,B text black,3.2,-2.5,normal,\pBsnA } \statement{ <p>On considère une expérience aléatoire, \(\A) et \(\B) sont deux événements.</p> <p> <b>Etape 1:</b> compléter l'arbre.</p> \canvasdraw{450,300}{\dessinarbre} \special{drawinput [\dessinarbre], 450 x 300, 1 reply1,0.5 x -1 reply2,2.75 x 3.5 reply3,2.75 x -5.4 } } \answer{pnA}{\pnA}{type=default} \answer{pnBsA}{\pnBsA}{type=default} \answer{pnBsnA}{\pnBsnA}{type=default}
- le \overline{A} ne passe pas dans la fonction latex x,y,Texcod
-
7 juillet 2020 à 12:43 #5883
jm.evers
Participant::The overline seems to work just fine…
search for ‘direct’ or ‘direct exec’ in wims
copy & paste this in the textarea
execute by ‘canvasdraw’size 400,400 xrange -10,10 yrange -10,10 fontfamily 148px Arial strokecolor green drag xy centered latex 0,0,\overline{B}
joke
-
Cette réponse a été modifiée le il y a 2 années et 11 mois par
jm.evers.
-
Cette réponse a été modifiée le il y a 2 années et 11 mois par
-
7 juillet 2020 à 13:56 #5885
Christophe Barnier
Participant -
7 juillet 2020 à 13:58 #5886
-
7 juillet 2020 à 14:02 #5887
jm.evers
Participant::on https://wims.auto.u-psud.fr/
-
Cette réponse a été modifiée le il y a 2 années et 11 mois par
jm.evers.
-
Cette réponse a été modifiée le il y a 2 années et 11 mois par
-
7 juillet 2020 à 14:33 #5889
jm.evers
Participant::I’m not familiar with the ‘special; oef methods…but there are no input fields
in your oef script…however in the ‘correct’ answer they are displayed
So you have to ask Bernadette Perrin…
Inputfields are working fine in canvasdrawsize 400,400 xrange -10,10 yrange -10,10 linewidth 6 point 1,2,red input 1,2,5,1, ? point -5,5,red input -5,5,5,1, ? point 6,-5,red input 6,-5,5,1, ? point -5,-8,red input -5,-8,5,1, ?
-
7 juillet 2020 à 15:42 #5892
Christophe Barnier
Participant
-
-
7 juillet 2020 à 15:45 #5893
Christophe Barnier
Participant::J’ai corrigé les erreurs d’affectation mais c’étaient des erreurs marginales…
Il reste toujours les deux bugs, pas d’affichage de l’\overline{}, et problème avec le drawinput, à l’aide Bernadette…\title{Arbre de probabilité à compléter} \language{fr} \range{-5..5} \author{Barnier Christophe} \email{barnierchr@gmail.com} \computeanswer{no} \format{html} \precision{10000} \real{pA=randint(1..99)/100} \real{pnA=1-\pA} \real{pBsA=randint(1..99)/100} p de B sachant A \real{pnBsA=1-\pBsA} \real{pBsnA=randint(1..99)/100} \real{pnBsnA=1-\pBsnA} \real{pAB=\pA*\pBsA} \real{pAnB=\pA*\pnBsA} \real{pnAB=\pnA*\pBsnA} \real{pnAnB=\pnA*\pnBsnA} \real{pB=\pAB+\pnAB} \real{pnB=1-\pB} \integer{ipAsB=round{\pAB/\pB*100}} \real{pAsB=\ipAsB/100} \real{pnAsB=1-\pAsB} \integer{ipAsnB=round{\pAnB/\pnB*100}} \real{pAsnB=\ipAsnB/100} \real{pnAsnB=1-\pAsnB} \text{dessinarbre= xrange 0,10 yrange -10,10 text black,0,-0.5,large,* arrow 0.3,0,2,4.5,10,black strokecolor red latex 2.2,5,A text black,0.5,2.6,normal,\pA arrow 2.5,4.5,4.5,7,10,black strokecolor red latex,4.7,7.4,B text black,3.2,6.5,normal,\pBsA arrow 2.5,4.5,4.5,2,10,black strokecolor red drag xy centered latex 4.7,2.4,\overline{B} arrow 0.3,0,2,-4.5,10,black strokecolor red latex,2.2,-4,\overline{A} arrow 2.5,-4.5,4.5,-7,10,black strokecolor red latex,4.7,-6.8,\overline{B} arrow 2.5,-4.5,4.5,-2,10,black strokecolor red latex,4.7,-1.5,B text black,3.2,-2.5,normal,\pBsnA } \statement{ <p>On considère une expérience aléatoire, \(\A) et \(\B) sont deux événements.</p> <p> <b>Etape 1:</b> compléter l'arbre.</p> \canvasdraw{450,300}{\dessinarbre} \special{drawinput [\dessinarbre], 450 x 300, 1 reply1,0.5 x -1 reply2,2.75 x 3.5 reply3,2.75 x -5.4 } } \answer{pnA}{\pnA}{type=default} \answer{pnBsA}{\pnBsA}{type=default} \answer{pnBsnA}{\pnBsnA}{type=default}
-
7 juillet 2020 à 17:20 #5894
jm.evers
Participant::In canvasdraw the command input (from docs)
@ input x,y,size,editable,value @ to set inputfield "readonly", use editable = 0 @ if no preset 'value' is needed...use a 'space' as last item argument
The last argument ‘value’ can not be an empty string…
So if you have source code access to your wims server, you can quick fix this by editing scripts/oef/special/drawinput.phtml
and add:blah blah !if $(reply$n_) = $empty !set reply$n_=? !endif !set codeinput=!append line input $[$x_],$[$y_],$(inputsize_tmp[2]),1,$(reply$n_) $ $ to $code !endif The \overline is probably eaten by some oef-script You could try a direct call to canvasdraw...
\text{test=wims(exec canvasdraw
size 200,200
xrange 0,4
yrange 0,4
linewidth 5
input 1,1,1,1,?
latex 2,2,\Huge{\overline{B}})}
\statement{
\test
}I will see if this can be changed within canvasdraw (e.g. accepting an empty string...) kind regards Joke
-
7 juillet 2020 à 17:41 #5898
-
-
8 juillet 2020 à 08:27 #5899
-
-
AuteurMessages
- Vous devez être connecté pour répondre à ce sujet.