Skip to content

Techipeeyon/Hacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

Hacks - Week One Task

Discriminant and Nature of Roots

Our aim is to develop system which finds the discriminant of the quadratic equation and finds its nature.


Discriminant

The discriminant of a polynomial is a quantity that depends on the coefficients and determines various properties of the roots. The discriminant of a polynomial is generally defined in terms of a polynomial function of its coefficients.


Nature of Roots

The discriminant determines the nature of the roots of a quadratic equation. The word 'nature' refers to the types of numbers the roots can be — namely real, rational, irrational or imaginary.


if D>0: "the roots are real and distinct."

if d > 0:
 d**=0.5
 r1 = (-b+d)/(2*a)
 r2 = (-b-d)/(2*a)
 print("The roots are real and distinct")
 print("The roots are :",r1,r2)

Distinct Roots Graph


if D=0: "the roots are real and equal."

elif d == 0:
 r = (-b)/(2*a)
 print("The roots are real and equal")
 print("The roots are : {}, {}".format(r,r))

real and equal Roots Graph

if D<0: "the roots are imaginary."

else:
 d = ((4*a*c)-(b**2))**0.5
 r = (-b)/(2*a)
 i = (d)/(2*a)
 print("Imaginary roots")
 print("The roots are : {}+{}i, {}-{}i".format(r,i,r,i))

Imaginary Roots Graph

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages