Celeritas 0.7.0-dev.245+develop.a7be925e
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::FerrariSolver Class Reference

Find positive, real roots for quartic functions using Ferarri. More...

#include <FerrariSolver.hh>

Public Types

Type aliases
using Real4 = Array< real_type, 4 >
 
using Real5 = Array< real_type, 5 >
 
using result_type = Real4
 

Public Member Functions

 FerrariSolver (real_type tolerance)
 Construct a solver instance with a specified tolerance for degenerate cases, such as the particle starting on the surface.
 
 FerrariSolver ()
 Construct with default tolerance equal to Orange Tolerance.
 
result_type operator() (Real5 const &abcde) const
 Find all positive roots of the polynomial with given a, b, c, d, e.
 
result_type operator() (Real4 const &abcd) const
 Solve a quartic polynomial where coefficient e is known to be 0.
 

Detailed Description

Find positive, real roots for quartic functions using Ferarri.

The quartic solver uses the Ferrari method (polyanin-ferrari-2007), using the underlying quadratic and cubic solutions from press-nr-1992 .

The quartic equation

\[ a x^4 + b x^3 + c x^2 + d x + e = 0 \]

has four solutions mathematically, but we only require solutions which are both real and positive. This equation is also subject to multiple cases of catastrophic precision-limitation-based error both fundamentally and as a consequence of the particular algorithm chosen. This solver implements the Ferrari method, which is well-established and simple, but more prone to numerical error than contemporary methods to be explored such as Algorithm 1010 (orellana-alg1010-2020).

The input argument to an instance of this class is an array abcde that corresponds to {a, b, c, d, e}. An overload using a four-element array abcd solves the degenerate case where \( e = 0 \).

The result is an array of 4 real numbers, where each is either a positive valid intersection or the sentinel result infinity.

Member Function Documentation

◆ operator()() [1/2]

auto celeritas::FerrariSolver::operator() ( Real4 const abcd) const
inline

Solve a quartic polynomial where coefficient e is known to be 0.

Solves as cubic equation, and does not return the known root of 0.

◆ operator()() [2/2]

auto celeritas::FerrariSolver::operator() ( Real5 const abcde) const
inline

Find all positive roots of the polynomial with given a, b, c, d, e.

Replaces negative or complex roots with sentry value no_solution_.

Allows user to specify if the operation takes place on the surface, in which case it will solve as a cubic to avoid the root at 0.


The documentation for this class was generated from the following file: