Python  1.0
Functions
_01b_eqn2 Namespace Reference

Solving second degree equations. More...

Functions

def eqn2 (a, b, c)
 Solves a second degree equation: \(ax²+bx+c=0\). More...
 
def main ()
 

Detailed Description

Solving second degree equations.

Having \(ax^2+bx+c=0,\) the roots are given by the quadratic formula

\[x=\frac{-b \pm \sqrt {b^2-4ac}}{2a},\]

where the symbol "±" indicates that both \(x=\frac{-b + \sqrt {b^2-4ac}}{2a}\quad\text{and}\quad x=\frac{-b - \sqrt {b^2-4ac}}{2a}\) are solutions of the quadratic equation.

Author
Paulo Roma
Since
15/04/2010
See also
http://en.wikipedia.org/wiki/Quadratic_equation

Function Documentation

◆ eqn2()

def _01b_eqn2.eqn2 (   a,
  b,
  c 
)

Solves a second degree equation: \(ax²+bx+c=0\).

Parameters
aa coefficient.
bb coefficient.
cc coefficient.
Returns
root1, root2

Referenced by main().

◆ main()

def _01b_eqn2.main ( )

References eqn2(), and _01d_dec2bin.input.