#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Pyromaths
# Un programme en Python qui permet de créer des fiches d'exercices types de
# mathématiques niveau collège ainsi que leur corrigé en LaTeX.
# Copyright (C) 2006 -- Jérôme Ortais (jerome.ortais@pyromaths.org)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
##- additions / soustractions de vecteurs ( difficulté : ne pas sortir du cadre )
##- multiplication d'un vecteur par un réel + add + sous ( difficulté : ne pas sortir du cadre )
##- lire les coordonnées d'un vecteur
##- placer un point B connaissant A et les coordonnées de vec{AB} : avec coordonnées ou i et j ( difficulté : ne pas sortir du cadre )
##- calcul de norme
##- simplifier des sommes
##- problèmes de colinéarité
from ..classes.Vecteurs import randvect, Vecteur
from ..classes.Racine import simplifie_racine
from ..outils.decimaux import decimaux_quiz
import math
from random import randint, shuffle
def dist_bords(a,b):
'''Calcule les distances minimales d'un point de coordonnées (a,b) aux bords du cadre, selon l'axe x et y.'''
x = min(a,18-a) # la largeur vaut 18
y = min(b,10-b) # la hauteur vaut 10
return (x,y)
def AffNom(u,crd = 0):
'''Renvoie les coordonnées pour l'affichage du nom du vecteur u.'''
if u.x == 0 and math.fabs(u.y) > 2:
coord = (0,u.y / 2)
elif u.x == 0:
coord = (-0.5,u.y / 2)
elif u.y == 0 and math.fabs(u.x) > 2:
coord = (u.x / 2, 0)
elif u.y == 0:
coord = (u.x / 2, - 0.5)
elif math.fabs(u.x)+math.fabs(u.y) < 3:
coord = (u.x/ 2.0 + 0.5,u.y / 2.0 + 0.5)
else:
coord = (u.x /2,u.y / 2)
return str(coord[0]) + "," + str(coord[1])
def ChoixVecteur(u,v,w,x,y):
listecoeff = [0.5, -0.5, -1, -2, 2, 3, -3]
listevect = [(u,"u"),(v,"v"),(w,"w")]
shuffle(listecoeff)
shuffle(listevect)
for vec in listevect:
for coeff in listecoeff:
if ( 0 <= x + coeff * vec[0].x <= 18 ) and ( 0 <= y + coeff * vec[0].y <= 10 ):
return (coeff, coeff * vec[0], vec[1])
def repr_somme(u,v,u1,u2,cor,larg=0):
'''Représente la somme des vecteurs u + v.'''
a = u + v
if (u.x * a.x >= 0 ):
largeur = max(math.fabs(u.x),math.fabs(a.x))
if ( a.x > 0 ):
departx = 0
elif ( a.x == 0 ):
departx = -u.x/2.0+math.fabs(u.x)/2
else:
departx = max(math.fabs(u.x),math.fabs(a.x))
else:
largeur = math.fabs(u.x)+math.fabs(a.x)
if ( u.x >= 0 ):
departx = -a.x
else:
departx = -u.x
if (u.y * a.y >= 0 ):
hauteur = max(math.fabs(u.y),math.fabs(a.y))
if ( a.y > 0 ):
departy = 0
elif ( a.y == 0 ):
departy = -u.y/2.0+math.fabs(u.y)/2
else:
departy = max(math.fabs(u.y),math.fabs(a.y))
else:
hauteur = math.fabs(u.y)+math.fabs(a.y)
if ( u.y >= 0 ):
departy = -a.y
else:
departy = -u.y
somme_largeur = larg + largeur + 1
if somme_largeur > 18:
cor.append("\\par") # Figure trop large avec la précédente, il faut passer à une nouvelle ligne.
somme_largeur -= 18
depart = "(" + str(departx+1) + "," + str(departy+1) + ")" ## MIO y eliminación de "def pair(n)"
largeur = str(float(largeur)+1.5) ## MIO
hauteur = str(float(hauteur)+1.5) ## MIO
cor.append(u"\\begin{pspicture*}(0.5,0.5)(" + largeur + "," + hauteur + ")") ## MIO
cor.append(u"\\psgrid[subgriddiv=2, gridlabels=0pt]")
cor.append(u"\\psset{unit=10mm,arrowscale=2}")
cor.append(u"\\rput" + depart + "{")
cor.append(u"\\psline[linewidth=1pt, linecolor=DarkGreen]{|->}(0, 0)(" + str(u.x) + ", " + str(u.y) + ")") ## Premier Vecteur
cor.append(u"\\rput(" + AffNom(u) + ") \
{\\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{\\textcolor{DarkGreen}{$\\overrightarrow{" + u1 + "}$}}}")
cor.append(u"\\psline[linewidth=1pt, linecolor=DarkBlue]{|->}(" + str(u.x) + ", " + str(u.y) + ")(" + str(a.x) + ", " + str(a.y) + ")") ## 2e Vecteur
k = Vecteur(u.x+a.x,u.y+a.y)
cor.append(u"\\rput(" + AffNom(k) + ") \
{\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{\\textcolor{DarkBlue}{$\\overrightarrow{" + u2 + "}$}}}")
if len(u2)>1:
sgn = "-"
else:
sgn = "+"
cor.append(u"\\psline[linestyle=dashed, linewidth=1pt, linecolor=DarkRed]{|->}(0, 0)(" + str(a.x) + ", " + str(a.y) + ")") ## Résultat de l'opération
cor.append(u"\\rput(" + AffNom(a) + ") \
{\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{\\textcolor{DarkRed}{$\\overrightarrow{" + u1 + "}" + sgn + "\\overrightarrow{" + u2[-1] + "}$}}}")
cor.append(u"}")
cor.append(u"\\end{pspicture*}")
return somme_largeur ## récupérer la largeur pour éviter d'aligner des figures trop larges sur la feuille
def vecteurs_add():
'''Exercice sur la définition des vecteurs et leurs sommes.'''
t = None
while not t:
# Pour être sûr que l'exercice ait des solutions
(u, posux, posuy) = randvect(0, 10)
(v, posvx, posvy) = randvect(math.fabs(u.x)+1, 10)
(w, poswx, poswy) = randvect(math.fabs(v.x)+math.fabs(u.x)+2, 10)
## Construction du point pour la question 2
if 18 - poswx - max(w.x,0) > 0:
restes = (18 - poswx - max(w.x,0),10)
pointy = randint(0,10)
elif poswy + min(w.y,0) > 10 - poswy - max(w.y,0):
restes = (poswx+min(w.x,0),poswy + min(w.y,0))
pointy = randint(0,restes[1])
else:
restes = (poswx+min(w.x,0),10 - poswy - max(w.y,0))
pointy = randint(10 - restes[1],10)
pointx = randint(18 - restes[0],18)
t = ChoixVecteur(u,v,w,pointx,pointy)
exo=["\\exercice"]
cor=["\\exercice*"]
quiz=["cloze"]
exo.append(u"\\begin{pspicture*}(0,0)(18,10)")
exo.append(u"\\psgrid[subgriddiv=2, gridlabels=0pt]")
exo.append(u"\\psset{unit=10mm,arrowscale=2}")
cor.append(u"\\begin{pspicture*}(0,0)(18,10)")
cor.append(u"\\psgrid[subgriddiv=2, gridlabels=0pt]")
cor.append(u"\\psset{unit=10mm,arrowscale=2}")
exo.append(u"\\psdot(" + str(pointx) + "," + str(pointy) + ")")
if pointx < 18 and pointy < 10:
nompoint = str(pointx+0.5) + "," + str(pointy+0.5)
else:
nompoint = str(pointx-0.5) + "," + str(pointy-0.5)
exo.append(u"\\rput(" + nompoint + "){\\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{$A$}}")
cor.append(u"\\psdot(" + str(pointx) + "," + str(pointy) + ")")
cor.append(u"\\rput(" + nompoint + "){\\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{$A$}}")
cor.append(u"\psline[linecolor=DarkBlue]{|->}(" + str(pointx) + "," + str(pointy) + ")(" + str(pointx + t[1].x) + ", " + str(pointy + t[1].y) + ")")
bx = pointx + t[1].x
by = pointy + t[1].y
if bx < 18 and by < 10:
nompoint = str(bx+0.5) + "," + str(by+0.5)
else:
nompoint = str(bx-0.5) + "," + str(by-0.5)
cor.append(u"\\psdot(" + str(pointx + t[1].x) + "," + str(pointy + t[1].y) + ")")
cor.append(u"\\rput(" + nompoint + "){\\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{$B$}}")
for vec in [(u, posux, posuy, "u"), (v, posvx, posvy, "v"), (w, poswx, poswy, "w")]:
exo.append(u"\\rput(" + str(vec[1]) + "," + str(vec[2]) + "){")
exo.append(u"\psline{|->}(0, 0)(" + str(vec[0].x) + ", " + str(vec[0].y) + ")")
exo.append(u"\\rput(" + AffNom(vec[0]) + ") \
{\\psframebox[linecolor=white, fillcolor=white, fillstyle=solid]{$\\overrightarrow{" + vec[3] + "}$}}")
exo.append(u"}")
exo.append(u"\\end{pspicture*}")
for vec in [(u, posux, posuy, "u"), (v, posvx, posvy, "v"), (w, poswx, poswy, "w")]:
if vec[0].y>0:
plus = 1
else:
plus = 0
cor.append(u"\\rput(" + str(vec[1]) + "," + str(vec[2]) + "){")
cor.append(u"\\psline{|->}(0, 0)(" + str(vec[0].x) + ", " + str(vec[0].y) + ")")
cor.append(u"\\psline[linestyle=dashed,linecolor=DarkRed](0, 0)(" + str(vec[0].x) + ", 0)(" + str(vec[0].x) + "," + str(vec[0].y) + ")")
cor.append(u"\\rput(" + AffNom(vec[0]) + "){\\psframebox[linecolor=white, fillcolor=white, \
fillstyle=solid]{$\\overrightarrow{" + vec[3] + "}\\ (" + str(vec[0].x) + ";" + str(vec[0].y) + ")$}}")
cor.append(u"}")
cor.append(u"\\end{pspicture*}")
exo.append("\\par")
cor.append("\\par")
exo.append(_(u"On se place dans un repère orthonormé et on considère les vecteurs $\\overrightarrow{u}$, $\\overrightarrow{v}$, et $\\overrightarrow{w}$ ci-dessous."))
cor.append(_(u"On se place dans un repère orthonormé et on considère les vecteurs $\\overrightarrow{u}$, $\\overrightarrow{v}$, et $\\overrightarrow{w}$ ci-dessous."))
exo.append("\\begin{enumerate}")
cor.append("\\begin{enumerate}")
exo.append(_(u"\\item Lire les coordonnées de chacun des vecteurs $\\overrightarrow{u}$, $\\overrightarrow{v}$, et $\\overrightarrow{w}$."))
cor.append(_(u"\\item Lire les coordonnées de chacun des vecteurs $\\overrightarrow{u}$, $\\overrightarrow{v}$, et $\\overrightarrow{w}$."))
cor.append("\\par")
cor.append(_(u"Un petit rappel : l'abscisse d'un vecteur est la différence d'abscisse entre le fin et le début du vecteur. \
Concernant le vecteur $\\overrightarrow{u}$, son abscisse est $") + str(u.x) + _(u"$. \
On lit également son ordonnée : $") + str(u.x) + _(u"$. \
Donc les coordonnées de $\\overrightarrow{u}$ sont $(") + str(u.x) + ", " + str(u.y) + _(u" )$. \
Des pointillés ont été ajoutés sur la figure pour faciliter la lecture des coordonnées."))
cor.append(_(u"De même, les coordonnées de $\\overrightarrow{v}$ sont $(") + str(v.x) + ", " + str(v.y) + _(u" )$ \
et les coordonnées de $\\overrightarrow{w}$ sont $(") + str(w.x) + ", " + str(w.y) + " )$.")
exo.append(_(u"\\item Placer un point B de sorte que le vecteur $\\overrightarrow{AB}$ soit égal à $") + str(t[0]) + _(" \\times \\overrightarrow{") + t[2] + "}$.")
cor.append(_(u"\\item Placer un point B de sorte que le vecteur $\\overrightarrow{AB}$ soit égal à $") + str(t[0]) + _(" \\times \\overrightarrow{") + t[2] + "}$.")
cor.append(u"\\par")
cor.append(_(u"Le plus simple pour répondre à cette question est de calculer les coordonnées du vecteur $") + str(t[0]) + _(" \\times \\overrightarrow{") + str(t[2]) + "}$.")
cor.append(_(u"Cela se fait en multipliant les coordonnées de $\\overrightarrow{") + str(t[2]) + _(u"}$ par $") + str(t[0]) + _(u"$, ce qui donne comme résultat $(") + str(t[1].x) + ";" + str(t[1].y) + ")$.")
cor.append(_(u"En partant du point A et en respectant ces coordonnées, on dessine un vecteur (en bleu sur la figure ci-dessus) qui indique l'emplacement du point B."))
exo.append(_(u"\\item Calculer les normes de chacun des vecteurs $\\overrightarrow{u}$, $\\overrightarrow{v}$, et $\\overrightarrow{w}$."))
cor.append(_(u"\\item Calculer les normes de chacun des vecteurs $\\overrightarrow{u}$, $\\overrightarrow{v}$, et $\\overrightarrow{w}$."))
if u.x**2+u.y**2 == simplifie_racine(u.x**2+u.y**2)[1] and u.x**2+u.y**2 > 1: # Cas où la simplification est la même, donc inutile d'écrire deux fois la même chose.
Norm_u = "$"
Norm_u_quiz = ("$$ $$\\surd$${1:NUMERICAL:=%s}" %(u.x**2 + u.y**2))
else:
Norm_u = "=" + str(u.normeTex()) + "$"
if len(u.normeTex_quiz()) == 1:
Norm_u_quiz = ("$${1:NUMERICAL:=%s}" % u.normeTex_quiz())
else:
Norm_u_quiz = ("$${1:NUMERICAL:=%s}$$\\surd$${1:NUMERICAL:=%s}" % u.normeTex_quiz())
if v.x**2+v.y**2 == simplifie_racine(v.x**2+v.y**2)[1] and v.x**2+v.y**2 > 1:
Norm_v = "$"
Norm_v_quiz = ("$$ $$\\surd$${1:NUMERICAL:=%s}" %(v.x**2 + v.y**2))
else:
Norm_v = "=" + str(v.normeTex()) + "$"
if len(v.normeTex_quiz()) == 1:
Norm_v_quiz = ("$${1:NUMERICAL:=%s}" % v.normeTex_quiz())
else:
Norm_v_quiz = ("$${1:NUMERICAL:=%s}$$\\surd$${1:NUMERICAL:=%s}" % v.normeTex_quiz())
if w.x**2+w.y**2 == simplifie_racine(w.x**2+w.y**2)[1] and w.x**2+w.y**2 > 1:
Norm_w = "$"
Norm_w_quiz = ("$$ $$\\surd$${1:NUMERICAL:=%s}" %(w.x**2 + w.y**2))
else:
Norm_w = "=" + str(w.normeTex()) + "$"
if len(w.normeTex_quiz()) == 1:
Norm_w_quiz = ("$${1:NUMERICAL:=%s}" % w.normeTex_quiz())
else:
Norm_w_quiz = ("$${1:NUMERICAL:=%s}$$\\surd$${1:NUMERICAL:=%s}" % w.normeTex_quiz())
cor.append("\\par")
cor.append(u"$\|\\overrightarrow{u}\|=\\sqrt{(" + str(u.x) + ")^2+(" + str(u.y) + ")^2}=\\sqrt{" + str(u.x**2) + " + " + str(u.y**2) + "}= \
\\sqrt{" + str(u.x**2 + u.y**2) + "}" + Norm_u + ".\\par")
cor.append(_(u"De la même manière, on obtient :"))
cor.append(u"$\|\\overrightarrow{v}\|=\\sqrt{(" + str(v.x) + ")^2+(" + str(v.y) + ")^2}=\\sqrt{" + str(v.x**2) + " + " + str(v.y**2) + "}= \
\\sqrt{" + str(v.x**2 + v.y**2) + "}" + Norm_v + _(u" et \\par"))
cor.append(u"$\|\\overrightarrow{w}\|=\\sqrt{(" + str(w.x) + ")^2+(" + str(w.y) + ")^2}=\\sqrt{" + str(w.x**2) + " + " + str(w.y**2) + "}= \
\\sqrt{" + str(w.x**2 + w.y**2) + "}" + Norm_w + ".\\par")
exo.append(_(u"\\item Dessiner des représentants des vecteurs $\\overrightarrow{u}+\\overrightarrow{v}$, $\\overrightarrow{u}-\\overrightarrow{v}$, $\\overrightarrow{u}-\\overrightarrow{w}$ \
et $\\overrightarrow{v}+\\overrightarrow{w}$."))
cor.append(_(u"\\item Dessiner des représentants des vecteurs $\\overrightarrow{u}+\\overrightarrow{v}$, $\\overrightarrow{u}-\\overrightarrow{v}$, $\\overrightarrow{u}-\\overrightarrow{w}$ \
et $\\overrightarrow{v}+\\overrightarrow{w}$."))
cor.append("\\par")
cor.append(_(u"Pour dessiner les sommes ou différences de vecteurs, il faut les mettre \"bouts à bouts\", \
comme sur les figures qui suivent :\\par"))
exo.append("\\end{enumerate}")
cor.append("\\end{enumerate}")
i = repr_somme(u,v,'u','v',cor)
j = repr_somme(u,-v,'u','-v',cor,i)
k = repr_somme(u,-w,'u','-w',cor,j)
repr_somme(v,w,'v','w',cor,k)
quiz_nom = _(u"Vecteurs")
quiz_exo_cor = coord_quiz([[u,posux,posuy,"u"],[v,posvx,posvy,"v"],[w,poswx,poswy,"w"]],pointx,pointy)
quiz_exo_cor += _(u"Observe l'antérieur système de coordonnées avec les vecteurs $$\\vec{u}\\,$$,$$\\,\\vec{v}\\,$$ y $$\\,\\vec{w}$$:
\n")
quiz_exo_cor += _(u"• Trouve les coordonnées de chacun des vecteurs:
\n")
quiz_exo_cor += (_(u"Réponse: ")+"$$\\vec{u}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}" % (u.x,u.y))
quiz_exo_cor += (u"$$)\\,\\vec{v}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}" % (v.x,v.y))
quiz_exo_cor += (u"$$)\\,\\vec{w}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}$$)$$
\n" % (w.x,w.y))
quiz_exo_cor += (_(u"• Écrit les coordonnées d'un point $$B$$ de manière que le vecteur $$\\vec{AB}$$ soit $$%s\\cdot\\vec{%s}$$:
\n") %
(t[0],t[2]))
#Cuando corrigan el bug de quiz sobre cloze y los decimales cambiar el se abajo a NUMERICAL (poner mathenv igual a 1)
quiz_exo_cor += (_(u"Réponse: ")+"$$B=($${1:SHORTANSWER:%s100%s%s}$$;$${1:SHORTANSWER:%s100%s%s}$$)$$
\n" %
("%", "%", decimaux_quiz(t[1].x+pointx,mathenv = 0), "%", "%", decimaux_quiz(t[1].y+pointy,mathenv = 0)))
quiz_exo_cor += _(u"• Calcule le module de chacun des vecteurs:
\n")
quiz_exo_cor += (_(u"Réponse: ")+"$$\\|\\vec{u}\\|=%s" % Norm_u_quiz)
quiz_exo_cor += (u"$$\\hspace*{30}\\|\\vec{v}\\|=%s" % Norm_v_quiz)
quiz_exo_cor += (u"$$\\hspace*{30}\\|\\vec{w}\\|=%s
\n" % Norm_w_quiz)
quiz_exo_cor += _(u"• Trouve les coordonnées du vecteur résultant des opérations des suivants vecteurs:
\n")
sol_quiz = u + v
quiz_exo_cor += (_(u"Réponse: ")+"$$\\vec{u}+\\vec{v}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}" %
(sol_quiz.x, sol_quiz.y))
sol_quiz = u - v
quiz_exo_cor += (u"$$)\\hspace*{20}\\vec{u}-\\vec{v}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}$$)$$
\n" %
(sol_quiz.x, sol_quiz.y))
sol_quiz = u - w
quiz_exo_cor += (u"$$\\hspace*{55}\\vec{u}-\\vec{w}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}" %
(sol_quiz.x, sol_quiz.y))
sol_quiz = v + w
quiz_exo_cor += (u"$$)\\hspace*{15}\\vec{v}+\\vec{w}=($${1:NUMERICAL:=%s}$$;$${1:NUMERICAL:=%s}$$)$$" %
(sol_quiz.x, sol_quiz.y))
quiz.append([quiz_nom, quiz_exo_cor, ""])
return exo,cor,quiz
def coord_quiz(vects,pointx,pointy):
# Inicio
quiz_quadrant = "$$\\fs3\\picture(600,360){"
# Líneas Horizontales
quiz_quadrant += "(30,30){\line(540,0)}(30,60){\line(540,0)}(30,90){\line(540,0)}(30,120){\line(540,0)}(30,150){\line(540,0)}(30,180){\line(540,0)}(30,210){\line(540,0)}(30,240){\line(540,0)}(30,270){\line(540,0)}(30,300){\line(540,0)}(30,330){\line(540,0)}"
# Líneas Verticales
quiz_quadrant += "(30,30){\line(0,300)}(60,30){\line(0,300)}(90,30){\line(0,300)}(120,30){\line(0,300)}(150,30){\line(0,300)}(180,30){\line(0,300)}(210,30){\line(0,300)}(240,30){\line(0,300)}(270,30){\line(0,300)}(300,30){\line(0,300)}(330,30){\line(0,300)}(360,30){\line(0,300)}(390,30){\line(0,300)}(420,30){\line(0,300)}(450,30){\line(0,300)}(480,30){\line(0,300)}(510,30){\line(0,300)}(540,30){\line(0,300)}(570,30){\line(0,300)}"
# Numeración eje OX
quiz_quadrant += "(55,10){1}(85,10){2}(115,10){3}(145,10){4}(175,10){5}(205,10){6}(235,10){7}(265,10){8}(295,10){9}(325,10){10}(355,10){11}(385,10){12}(415,10){13}(445,10){14}(475,10){15}(505,10){16}(535,10){17}(565,10){18}"
# Numeración eje OY
quiz_quadrant += "(15,10){0}(15,55){1}(15,85){2}(15,115){3}(15,145){4}(15,175){5}(15,205){6}(15,235){7}(15,265){8}(15,295){9}(10,325){10}"
# Punto A
pointx_quiz = (pointx+1)*30
pointy_quiz = (pointy+1)*30
quiz_quadrant += ("(%s,%s){\\bullet}(%s,%s){A}" %(pointx_quiz-3,pointy_quiz-3,pointx_quiz+5,pointy_quiz+5))
for j in range(len(vects)):
pointx_quiz = (vects[j][1]+1)*30
pointy_quiz = (vects[j][2]+1)*30
quiz_quadrant += ("(%s,%s){\\odot}" %(pointx_quiz-5,pointy_quiz-6))
quiz_quadrant += ("(%s,%s){\line(%s,%s)}" %
(pointx_quiz,pointy_quiz,vects[j][0].x*30,vects[j][0].y*30))
if vects[j][0].x > 0 and vects[j][0].y > 0:
quiz_quadrant += ("(%s,%s){\line(%s,%s)}" %
(pointx_quiz,pointy_quiz-1,vects[j][0].x*30,vects[j][0].y*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\bigtriangledown}" %
(pointx_quiz+vects[j][0].x*30-8,pointy_quiz+vects[j][0].y*30-12))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+vects[j][0].x*15-10,pointy_quiz+vects[j][0].y*15,vects[j][3]))
elif vects[j][0].x > 0 and vects[j][0].y < 0:
quiz_quadrant += ("(%s,%s){\line(%s,%s)}" %
(pointx_quiz,pointy_quiz-1,vects[j][0].x*30,vects[j][0].y*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\bigtriangle}" %
(pointx_quiz+vects[j][0].x*30-8,pointy_quiz+vects[j][0].y*30))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+vects[j][0].x*15+6,pointy_quiz+vects[j][0].y*15,vects[j][3]))
elif vects[j][0].x > 0 and vects[j][0].y == 0:
quiz_quadrant += ("(%s,%s){\line(%s,0)}" %
(pointx_quiz,pointy_quiz-1,vects[j][0].x*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\triangleright}" %
(pointx_quiz+vects[j][0].x*30-5,pointy_quiz-5))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+vects[j][0].x*15,pointy_quiz+6,vects[j][3]))
elif vects[j][0].x < 0 and vects[j][0].y > 0:
quiz_quadrant += ("(%s,%s){\line(%s,%s)}" %
(pointx_quiz,pointy_quiz-1,vects[j][0].x*30,vects[j][0].y*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\bigtriangledown}" %
(pointx_quiz+vects[j][0].x*30-4,pointy_quiz+vects[j][0].y*30-12))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+vects[j][0].x*15+6,pointy_quiz+vects[j][0].y*15,vects[j][3]))
elif vects[j][0].x < 0 and vects[j][0].y < 0:
quiz_quadrant += ("(%s,%s){\line(%s,%s)}" %
(pointx_quiz,pointy_quiz-1,vects[j][0].x*30,vects[j][0].y*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\bigtriangle}" %
(pointx_quiz+vects[j][0].x*30-4,pointy_quiz+vects[j][0].y*30))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+vects[j][0].x*15-10,pointy_quiz+vects[j][0].y*15+6,vects[j][3]))
elif vects[j][0].x < 0 and vects[j][0].y == 0:
quiz_quadrant += ("(%s,%s){\line(%s,0)}" %
(pointx_quiz,pointy_quiz-1,vects[j][0].x*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\triangleleft}" %
(pointx_quiz+vects[j][0].x*30-1,pointy_quiz-5))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+vects[j][0].x*15,pointy_quiz+6,vects[j][3]))
elif vects[j][0].x == 0 and vects[j][0].y > 0:
quiz_quadrant += ("(%s,%s){\line(0,%s)}" %
(pointx_quiz-1,pointy_quiz,vects[j][0].y*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\bigtriangle}" %
(pointx_quiz-6,pointy_quiz+vects[j][0].y*30-12))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+6,pointy_quiz+vects[j][0].y*15,vects[j][3]))
elif vects[j][0].x == 0 and vects[j][0].y < 0:
quiz_quadrant += ("(%s,%s){\line(0,%s)}" %
(pointx_quiz-1,pointy_quiz,vects[j][0].y*30)) # Doble linea para resaltar
quiz_quadrant += ("(%s,%s){\\bigtriangledown}" %
(pointx_quiz-6,pointy_quiz+vects[j][0].y*30))
quiz_quadrant += ("(%s,%s){\\vec{%s}}" %
(pointx_quiz+6,pointy_quiz+vects[j][0].y*15,vects[j][3]))
quiz_quadrant += "}$$
\n"
return quiz_quadrant