Skip to content
Snippets Groups Projects
Select Git revision
  • f4152d9a9bdeabc94c8b98d3b62da0fcce8b59e5
  • master default protected
2 results

test_pile.py

Blame
  • Forked from Vuillemot Romain / INF-TC1
    Source project has a limited visibility.
    math-racines.py 511 B
    from math import sqrt;
    
    def trinome(a, b, c):
        """ Résolution équation quadratique """
        delta = b**2 - 4*a*c
        if delta > 0.0:
            assert(a != 0)      
            racine_delta = sqrt(delta)
            return (2, (-b-racine_delta)/(2*a), (-b+racine_delta)/(2*a))
        elif delta < 0.0: return (0,)
        else: 
            assert(a != 0)     
            return (1, (-b/(2*a)))
        
    if __name__ == "__main__":
        print(trinome(1.0, -3.0, 2.0))
        print(trinome(1.0, -2.0, 1.0))
        print(trinome(1.0, 1.0, 1.0))