How to use the pyromaths.outils.Arithmetique.ppcm function in pyromaths

To help you get started, we’ve selected a few pyromaths examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / equations.py View on Github external
def valeurs(pyromax):  # crée les valeurs aléatoires pour l'équation
    while True:
        coefs = [Arithmetique.valeur_alea(-pyromax, pyromax) for i in range(6)]
        sgn = Arithmetique.valeur_alea(-1, 1)
        if sgn > 0:
            signe = "+"
        else:
            signe = "-"
        while True:
            while True:
                dens = [Arithmetique.valeur_alea(2, 9) for i in range(3)]
                if dens[0] != dens[1] and dens[0] != dens[2] and dens[1] != \
                    dens[2]:
                    break
            ppcm = Arithmetique.ppcm(dens[0], Arithmetique.ppcm(dens[1], dens[2]))
            densprim = [ppcm // dens[i] for i in range(3)]
            if densprim[0] < 10 and densprim[1] < 10 and densprim[2] < \
                10:
                break

        nvxcoefs = [coefs[i] * densprim[i // 2] for i in range(6)]
        if (nvxcoefs[0] + nvxcoefs[2] * sgn) - nvxcoefs[4] != 0:
            break
    return (tuple(coefs), tuple(dens), tuple(densprim), (signe, sgn),
            tuple(nvxcoefs))
github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / systemes.py View on Github external
def systemes(exo, cor, v):
    a = Arithmetique.ppcm(v[0][0], v[1][0])
    b = Arithmetique.ppcm(v[0][1], v[1][1])
    (a0, a1, b0, b1) = (a // v[0][0], -a // v[1][0], b // v[0][1], -b // v[1][1])
    if a0 < 0:
        (a0, a1) = (-a0, -a1)
    if b0 < 0:
        (b0, b1) = (-b0, -b1)
    if min(abs(a0), abs(a1)) > min(abs(b0), abs(b1)):
        (a0, a1) = (b0, b1)
    exo.append('$%s$' % tex_systeme(v))
    cor.append('$%s$' % tex_systeme(v, (a0, a1)))

    c1 = combinaison1(v, a0, a1)
    cor.append('''\\vspace{2ex}
  \\begin{multicols}{2}\\noindent
''')
    cor.append(u'\\[ ' + tex_systeme(c1) +
github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / equations.py View on Github external
def valeurs(pyromax):  # crée les valeurs aléatoires pour l'équation
    while True:
        coefs = [Arithmetique.valeur_alea(-pyromax, pyromax) for i in range(6)]
        sgn = Arithmetique.valeur_alea(-1, 1)
        if sgn > 0:
            signe = "+"
        else:
            signe = "-"
        while True:
            while True:
                dens = [Arithmetique.valeur_alea(2, 9) for i in range(3)]
                if dens[0] != dens[1] and dens[0] != dens[2] and dens[1] != \
                    dens[2]:
                    break
            ppcm = Arithmetique.ppcm(dens[0], Arithmetique.ppcm(dens[1], dens[2]))
            densprim = [ppcm // dens[i] for i in range(3)]
            if densprim[0] < 10 and densprim[1] < 10 and densprim[2] < \
                10:
                break

        nvxcoefs = [coefs[i] * densprim[i // 2] for i in range(6)]
        if (nvxcoefs[0] + nvxcoefs[2] * sgn) - nvxcoefs[4] != 0:
            break
    return (tuple(coefs), tuple(dens), tuple(densprim), (signe, sgn),
            tuple(nvxcoefs))
github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / systemes.py View on Github external
def systemes(exo, cor, v):
    a = Arithmetique.ppcm(v[0][0], v[1][0])
    b = Arithmetique.ppcm(v[0][1], v[1][1])
    (a0, a1, b0, b1) = (a // v[0][0], -a // v[1][0], b // v[0][1], -b // v[1][1])
    if a0 < 0:
        (a0, a1) = (-a0, -a1)
    if b0 < 0:
        (b0, b1) = (-b0, -b1)
    if min(abs(a0), abs(a1)) > min(abs(b0), abs(b1)):
        (a0, a1) = (b0, b1)
    exo.append('$%s$' % tex_systeme(v))
    cor.append('$%s$' % tex_systeme(v, (a0, a1)))

    c1 = combinaison1(v, a0, a1)
    cor.append('''\\vspace{2ex}
  \\begin{multicols}{2}\\noindent
''')
    cor.append(u'\\[ ' + tex_systeme(c1) + 
                     '\\quad\\text{\\footnotesize On ajoute les deux lignes}' + '\\] ')
github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / systemes.py View on Github external
def systemes(exo, cor, v):
    a = Arithmetique.ppcm(v[0][0], v[1][0])
    b = Arithmetique.ppcm(v[0][1], v[1][1])
    (a0, a1, b0, b1) = (a // v[0][0], -a // v[1][0], b // v[0][1], -b // v[1][1])
    if a0 < 0:
        (a0, a1) = (-a0, -a1)
    if b0 < 0:
        (b0, b1) = (-b0, -b1)
    if min(abs(a0), abs(a1)) > min(abs(b0), abs(b1)):
        (a0, a1) = (b0, b1)
    exo.append('$%s$' % tex_systeme(v))
    cor.append('$%s$' % tex_systeme(v, (a0, a1)))

    c1 = combinaison1(v, a0, a1)
    cor.append('''\\vspace{2ex}
  \\begin{multicols}{2}\\noindent
''')
    cor.append(u'\\[ ' + tex_systeme(c1) +
github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / fractions.py View on Github external
def den_com0(a, b):  #renvoie un tuple contenant les 2 nombres par lesquels multiplier les deux denominateurs pour obtenir leur ppcm
    c = ppcm(a[1], b[1])
    return (abs(c // a[1]), abs(c // b[1]))