How To Solve A Quadratic Equation On Python Complete Guide

Best Math Formula website. Search anything about Math Formula in this website.

how to solve a quadratic equation on python. In order to determine the quadratic equation we need one of the following. Now calculate the value of d and finally calculate the value of r1 and r2 to solve the quadratic equation of the given value of a b and c as shown in the program given below.

Forward Substitution The Algorithm And The Python Code
Forward Substitution The Algorithm And The Python Code from www.pinterest.com

Import complex math module import cmath a floatinputEnter a. Calculate the discriminant d b2 - 4ac find two solutions sol1 -b-cmathsqrtd2a sol2 -bcmathsqrtd2a printThe solution are 0 and 1formatsol1sol2. Where ab and c are real numbers and a is not equal to zero.

Consider for example the following polynomial equation of degree 2 x 2 3x-0 with the coefficients a 1 b 3 and c -4 we then find.

It could be two roots and the vertex or two roots and the y-intercept or any three points. If you have a quadratic equation of the form ax2 bx c 0 then Example. When we try to solve the quadratic equation we find the root of the equation. Python program to solve quadratic equation.