Roots of a quadratic function: Difference between revisions
m
replaced buggy R version: where in hell did you see that roots are real when the real part of the discriminant is positive???
m (replaced buggy R version: where in hell did you see that roots are real when the real part of the discriminant is positive???) |
|||
Line 1,831:
=={{header|R}}==
d <- b * b - 4 * a * c + 0i▼
▲<lang R>quaddiscrroots <- function(a,b,c, tol=1e-5) {
▲ d <- b*b - 4*a*c + 0i
▲ root2 <- (-b - sqrt(d))/(2*a)
}
qroots(1, 0, 2i)
[1] 1-1i -1+1i</lang>
=={{header|Racket}}==
|