Eclipse SUMO - Simulation of Urban MObility
PolySolver Class Reference

Utility functions for solving quadratic and cubic equations in real domain. More...

#include <PolySolver.h>

Static Public Member Functions

static std::tuple< int, double, double, double > cubicSolve (double a, double b, double c, double d)
 Solver of cubic equation ax^3 + bx^2 + cx + d = 0. More...
 
static std::tuple< int, double, double > quadraticSolve (double a, double b, double c)
 Solver of quadratic equation ax^2 + bx + c = 0. More...
 

Detailed Description

Utility functions for solving quadratic and cubic equations in real domain.

Definition at line 32 of file PolySolver.h.

Member Function Documentation

◆ cubicSolve()

std::tuple< int, double, double, double > PolySolver::cubicSolve ( double  a,
double  b,
double  c,
double  d 
)
static

Solver of cubic equation ax^3 + bx^2 + cx + d = 0.

Returns only real-valued roots.

Parameters
[in]aThe coefficient of the cubic term x^3
[in]bThe coefficient of the quadratic term x^2
[in]cThe coefficient of the linear term x
[in]dThe coefficient of the constant term
Returns
The number of real roots and these real roots

Definition at line 74 of file PolySolver.cpp.

References M_PI, and quadraticSolve().

Referenced by HelpersEnergy::acceleration().

Here is the caller graph for this function:

◆ quadraticSolve()

std::tuple< int, double, double > PolySolver::quadraticSolve ( double  a,
double  b,
double  c 
)
static

Solver of quadratic equation ax^2 + bx + c = 0.

Returns only real-valued roots.

Parameters
[in]aThe coefficient of the quadratic term x^2
[in]bThe coefficient of the linear term x
[in]cThe coefficient of the constant term
Returns
The number of real roots and these real roots

Definition at line 34 of file PolySolver.cpp.

Referenced by cubicSolve().

Here is the caller graph for this function:

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