September 2017
Beginner to intermediate
396 pages
9h 46m
English
A quadratic equation is represented by ax^2 + bx + c = 0. There are three possible cases that we have to handle:
| Case | Condition | Root 1 | Root 2 | Remarks |
| I | a = 0 and b = 0 | ERROR | ERROR | |
| II | a = 0 | x = -c/b | Not applicable | Linear equation |
| III | a and b are non-zero, delta = b2 - 4ac | |||
| III-A | delta = 0 | -b/(2a) | -b/(2a) | Perfect square |
| III-B | delta > 0 | (-b+sqrt(delta))/(2a) | (-b-sqrt(delta))/(2a) | Real roots |
| III-C | delta < 0 | (-b+sqrt(delta))/(2a) | (-b-sqrt(delta))/(2a) | Complex roots |
We will define a module at the top of the file with the Quadratic module where the name of the module matches file name, and it starts with a capital letter. The Quadratic module is followed by the definition of module (data types and functions ...
Read now
Unlock full access