Roots of a quadratic function: Difference between revisions
Content added Content deleted
(add RPL) |
(Add implementation in K) |
||
Line 1,426: | Line 1,426: | ||
The roots of 10.00x² + 1.00x + 1.00 |
The roots of 10.00x² + 1.00x + 1.00 |
||
x₀ = (-0.05 + 0.31im, -0.05 - 0.31im)</pre> |
x₀ = (-0.05 + 0.31im, -0.05 - 0.31im)</pre> |
||
=={{header|K}}== |
|||
===K6=== |
|||
{{works with|ngn/k}} |
|||
<syntaxhighlight lang="k"> / sqr[x] and sqrt[x] must be provided |
|||
quf:{[a;b;c]; s:sqrt[sqr[b]-4*a*c];(-b+s;-b-s)%2*a} |
|||
quf[0.5;-2.5;2] |
|||
1.0 4.0 |
|||
quf[1;8;15] |
|||
-5.0 -3.0 |
|||
quf[1;10;1] |
|||
-9.898979485566356 -0.10102051443364424 |
|||
</syntaxhighlight> |
|||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |