How to use the pyromaths.outils.Arithmetique 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 / sixiemes / operations.py View on Github external
def valeurs():
    nba = Arithmetique.valeur_alea(111, 99999)
    while 1:
        nbb = Arithmetique.valeur_alea(111, 99999)
        if nbb - (nbb // 10) * 10:
            break
    puisb = Arithmetique.valeur_alea(-2, 0)
    nbb = nbb * 10 ** puisb
    deca = [str(nba)[i] for i in range(len(str(nba)))]
    decb = [str(nbb)[i] for i in range(len(str(nbb)))]
    if random.randrange(2):
        (nba, deca, nbb, decb) = (nbb, decb, nba, deca)
    if deca.count('.'):
        posa = deca.index('.')
    else:
        posa = len(deca)
    if decb.count('.'):
        posb = decb.index('.')
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 / racines.py View on Github external
def valeurs_aPbRc(pyromax):  # renvoie (coef0, coef1, coef2, carre0, carre1, carre2, b)
    while True:
        a = carres[random.randrange(len(carres))]
        b = carres[random.randrange(len(carres))]
        if a != b and Arithmetique.pgcd(a, b) != min(a, b):
            break
    while True:
        c = random.randrange(2, pyromax)
        d = Arithmetique.valeur_alea(-pyromax, pyromax)
        if c != d:
            break
    return (c, a, d, b)
github Pyromaths / pyromaths / src / pyromaths / ex / sixiemes / operations.py View on Github external
def plus(valeurmax):
    (a, b) = (Arithmetique.valeur_alea(1, valeurmax), Arithmetique.valeur_alea(1,
              valeurmax))
    return (a, b)
github Pyromaths / pyromaths / src / pyromaths / ex / quatriemes / calcul_mental.py View on Github external
def plus(pyromax):
    (a, b) = (Arithmetique.valeur_alea(-pyromax, pyromax), Arithmetique.valeur_alea(-pyromax,
              pyromax))
    return (a, b)
github Pyromaths / pyromaths / src / pyromaths / ex / quatriemes / calcul_mental.py View on Github external
def div(pyromax):
    (a, b) = (Arithmetique.valeur_alea(-pyromax, pyromax), Arithmetique.valeur_alea(-pyromax,
              pyromax))
    return (a * b, a)
github Pyromaths / pyromaths / src / pyromaths / ex / troisiemes / racines.py View on Github external
def valeurs_aPbRc(pyromax):  # renvoie (coef0, coef1, coef2, carre0, carre1, carre2, b)
    while True:
        a = carres[random.randrange(len(carres))]
        b = carres[random.randrange(len(carres))]
        if a != b and Arithmetique.pgcd(a, b) != min(a, b):
            break
    while True:
        c = random.randrange(2, pyromax)
        d = Arithmetique.valeur_alea(-pyromax, pyromax)
        if c != d:
            break
    return (c, a, d, b)