equation_2nd_degre.py

Created by danio

Created on September 17, 2019

264 Bytes

Ce script résout les équations du second degré : Pour cela, entrer “roots(a,b,c)” et remplacer a, b et c par vos valeurs. Le script affichera entre accolades la valeur de delta et plus loin les solutions.


from math import *
def roots(a,b,c):
  delta = b*b-4*a*c
  if delta == 0:
    return {delta}, -b/(2*a)
  elif delta > 0:
    x_1 = (-b-sqrt(delta))/(2*a)
    x_2 = (-b+sqrt(delta))/(2*a)
    return {delta}, x_1, x_2
  else: return {delta}

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.