[/
Copyright (c) 2021 Nick Thompson
Use, modification and distribution are subject to the
Boost Software License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
]

[section:quartic_roots Roots of Quartic Polynomials]

[heading Synopsis]

```
#include <boost/math/tools/quartic_roots.hpp>

namespace boost::math::tools {

// Solves ax⁴ + bx³ + cx² + dx + e = 0.
std::array<Real,3> quartic_roots(Real a, Real b, Real c, Real d, Real e);

}
```

[heading Background]

The `quartic_roots` function extracts all real roots of a quartic polynomial ax⁴+ bx³ + cx² + dx + e.
The result is a `std::array<Real, 4>`, which has length four, irrespective of the number of real roots the polynomial possesses.
(This is to prevent the performance overhead of allocating a vector, which often exceeds the time to extract the roots.)
The roots are returned in nondecreasing order. If a root is complex, then it is placed at the back of the array and set to a nan.

The algorithm uses the classical method of Ferrari, and follows [@https://github.com/erich666/GraphicsGems/blob/master/gems/Roots3And4.c Graphics Gems V],
with an additional Halley iterate for root polishing.
A typical use of a quartic real-root solver is to raytrace a torus.

[heading Performance and Accuracy]

On a consumer laptop, we observe extraction of the roots taking ~90ns.
The file `reporting/performance/quartic_roots_performance.cpp` allows determination of the speed on your system.

[endsect]
[/section:quartic_roots]
