#siano a, b, c i coefficienti di un polinomio di secondo grado p(n) = ax^2 + bx + c
from math import sqrt
a = int(input())
b = int(input())
c = int(input())
A = str(a)
B = str(b)
C = str(c)
DELTA = b**2 - 4*a*c
print()
print("- Il polinomio è:")
print()
if a != 1:
print(" " + A + "x^2 +", B + "x +", C)
else:
print(" " + "x^2 +", B + "x +", C)
if a != 0:
print()
if DELTA > 0:
print("- Le soluzioni sono:")
print()
print(" x1 =", (- b - sqrt(DELTA))/(2*a))
print(" x2 =", (- b + sqrt(DELTA))/(2*a))
elif DELTA == 0:
print("- Le soluzioni, che sono coincidenti, sono:")
print()
print(" x1, 2 = ", (- b - sqrt(DELTA))/(2*a))
else:
print("Non è scomponibile.")
if a != 0:
xVertice = -b/(2*a)
yVertice = (a*xVertice**2 + b*xVertice + c)
X = str(xVertice)
Y = str(yVertice)
print()
print("- Il vertice della parabola corrispondente ha coordinate (" + X + "; " + Y + ")")
if xVertice > 0:
if yVertice >= 0:
print(" ed è dunque nel primo quadrante.")
else:
print(" ed è dunque nel quarto quadrante.")
else:
if xVertice == 0:
if yVertice == 0:
print(" ed è dunque nell'origine del piano.")
else:
if yVertice < 0:
print(" ed è dunque nel quarto quadrante.")
else:
print(" ed è dunque nel secondo quadrante.")
else:
if yVertice > 0 :
print(" ed è dunque nel secondo quadrante.")
else:
print(" ed è dunque nel terzo quadrante.")
print()
if a > 0:
print("- La parabola ha la concavità rivolta verso l'alto.")
else:
if a == 0:
print("- I coefficienti dati non rapprensentao un parabola, bensì una retta di equazione: y =", B + 'x +', C + '.')
zero = str(-c/b)
print(" La retta si annulla in x =", zero)
else:
print("- La parabola ha la concavità rivolta verso il basso.")
print()
if DELTA>0:
h = abs(a*xVertice**2 + b*xVertice + c)
base = sqrt(DELTA)/a
Area = base*h*2/3
print("- L'area delimitata dalla parabola e dall'asse x è di", str(Area), "cm^2.")
To embed this project on your website, copy the following code and paste it into your website's HTML: