QuadraticEquation.hpp
Go to the documentation of this file.
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 /// \file
5 /// Declares functions for solving quadratic equations
6 
7 #pragma once
8 
9 #include <array>
10 
11 /*!
12  * \ingroup NumericalAlgorithmsGroup
13  * \brief Returns the positive root of a quadratic equation ax^2 + bx + c = 0
14  * \returns The positive root of a quadratic equation.
15  * \requires That there are two real roots, of which only one is positive.
16  */
17 double positive_root(double a, double b, double c);
18 
19 /*!
20  * \ingroup NumericalAlgorithmsGroup
21  * \brief Returns the two real roots of a quadratic equation ax^2 + bx + c =
22  * 0
23  * \returns An array of the roots of a quadratic equation
24  * \requires That there are two real roots.
25  */
26 std::array<double, 2> real_roots(double a, double b, double c);
double positive_root(double a, double b, double c)
Returns the positive root of a quadratic equation ax^2 + bx + c = 0.
Definition: QuadraticEquation.cpp:12
std::array< double, 2 > real_roots(double a, double b, double c)
Returns the two real roots of a quadratic equation ax^2 + bx + c = 0.
Definition: QuadraticEquation.cpp:22