Up |
_scienceMathsEquation2nd
Resolution of the quadratic equation (ax2 + bx +c = 0).
The results are in R only (not complex numbers)
Prototype :
fun [F F F] [F F]
- F : a.
- F : b.
- F : c.
Return : [F F] the result or nil if error
See also :
Example :
fun main ()=
_showconsole;
let _scienceMathsEquation2nd 1.0 2.0 (-.3.0) -> [p q] in
(
_fooF p; // 1.0
_fooF q; // -3.0
);
let _scienceMathsEquation2nd 1.0 2.0 3.0 -> [p q] in
(
_fooF p; // NIL // Complex number
_fooF q; // NIL // Complex number
);
let _scienceMathsEquation2nd (-.2.0) 2.0 1.0 -> [p q] in
(
_fooF p; // -0.366025
_fooF q; // 1.366025
);
0;;
Note
If the results are complex numbers, this function returns nil.
Results are approximations (depends on float definition)