previous chapterthe pico pagenext chapter


Quadratic equations

We will finish this chapter with a last example: finding the real roots of a quadratic equation ax2+bx+c = 0. We will start by considering the case where a equals 0:

The preceding transcript contains the definition of a function L(b,c) that solves this particular case.The general case can then be treated as follows:

The function Q(a,b,c) defers to L whenever a is zero; in the other case a discriminant D is computed and depending on its value the existence of a double root -b/2a or two distinct roots (-b ± ÷D)/2a is reported.


previous chapterthe pico pagenext chapter