EMath++
Classes for mathematical concepts
|
Class for representing and operating polynomials. More...
#include <emath.h>
Public Member Functions | |
Polynomial () noexcept | |
Default constructor for when initialized with no arguments. | |
Polynomial (const std::map< int, Monomial > mns) noexcept | |
Normal constructor for initialization with a std::map<int, Monomial> | |
Polynomial (const std::initializer_list< Monomial > mns) noexcept | |
List constructor for initialization with a std::initializer_list<Monomial> | |
Polynomial (const std::vector< Monomial > mns) noexcept | |
Vector constructor for initialization with a std::vector<Monomial> | |
Polynomial (const Polynomial &ogn) noexcept | |
Copy constructor for when initialized with an lvalue Polynomial object. | |
Polynomial (Polynomial &&ogn) noexcept | |
Move constructor for when initialized with an rvalue Polynomial object. | |
Polynomial & | operator= (const Polynomial &ogn) noexcept |
Assigment operator overload for when called with an lvalue. | |
Polynomial & | operator= (Polynomial &&ogn) noexcept |
Move assigment operator overload for when called with an rvalue. | |
bool | operator== (const Polynomial &ogn) const noexcept |
Equal logic operator overload. | |
bool | operator!= (const Polynomial &ogn) const noexcept |
Not equal logic operator overload. | |
bool | operator> (const Polynomial &ogn) const noexcept |
Greater than logic operator overload. | |
bool | operator< (const Polynomial &ogn) const noexcept |
Less than logic operator overload. | |
bool | operator>= (const Polynomial &ogn) const noexcept |
Greater or equal than logic operator overload. | |
bool | operator<= (const Polynomial &ogn) const noexcept |
Less or equal than logic operator overload. | |
Polynomial | operator+ (const Polynomial &ogn) const noexcept |
Addition operator overload. | |
Polynomial | operator- (const Polynomial &ogn) const noexcept |
Substraction operator overload. | |
Polynomial | operator* (const Polynomial &ogn) const noexcept |
Multiplication operator overload. | |
Polynomial | operator/ (const Polynomial &ogn) const noexcept |
Division operator overload. | |
Polynomial | operator% (const Polynomial &ogn) const noexcept |
Modulus operator overload. | |
Polynomial & | operator+= (const Polynomial &ogn) noexcept |
Addition assigment operator overload. | |
Polynomial & | operator-= (const Polynomial &ogn) noexcept |
Substraction assigment operator overload. | |
Polynomial & | operator*= (const Polynomial &ogn) noexcept |
Multiplication assigment operator overload. | |
Polynomial & | operator/= (const Polynomial &ogn) noexcept |
Division assigment operator overload. | |
Polynomial & | operator%= (const Polynomial &ogn) noexcept |
Modulus assigment operator overload. | |
int | get_degree () const noexcept |
Getter function for getting the degree of the Polynomial. | |
std::map< int, Monomial > | get_monomials () const noexcept |
Getter function for getting the monomials of the Polynomial. | |
bool | is_empty () const noexcept |
Function for knowing if the polynomial has or not any monomials. | |
bool | push_monomial (const Monomial &m) noexcept |
Function for appending a lvalue monomial to the Polynomial. | |
bool | push_monomial (Monomial &&m) noexcept |
Function for appending a rvalue monomial to the Polynomial. | |
std::string | get_expression () const noexcept |
Getter function for getting the expression of the Polynomial. | |
double | get_value (const double &x) const noexcept |
Calculus function for getting the value of the Polynomial at a point. | |
Polynomial | get_derivative () const noexcept |
Calculus function for getting the derivative of the Polynomial. | |
Polynomial | get_integral () const noexcept |
Calculus function for getting the integral of the Polynomial. | |
std::vector< std::complex< double > > | get_roots () const noexcept |
Calculus function for getting all the real and complex roots of the Polynomial using the Eigen library. | |
~Polynomial () | |
The class destructor. | |
Friends | |
std::stringstream & | operator<< (std::stringstream &ss, const Polynomial &p) noexcept |
A friend operator to insert the Polynomial into a std::stringstream. | |
std::ostream & | operator<< (std::ostream &out, const Polynomial &p) noexcept |
A friend operator to insert the Polynomial into a std::ostream. | |
Class for representing and operating polynomials.
The class consists of the constructors, the operators, the getters, the properties and some private functions.
|
noexcept |
|
noexcept |
Normal constructor for initialization with a std::map<int, Monomial>
mns | The std::map<int, Monomial>. |
|
noexcept |
List constructor for initialization with a std::initializer_list<Monomial>
mns | The std::initializer_list<Monomial>. |
|
noexcept |
Vector constructor for initialization with a std::vector<Monomial>
mns | The std::vector<Monomial>. |
|
noexcept |
Copy constructor for when initialized with an lvalue Polynomial object.
ogn | The lvalue Polynomial object. |
|
noexcept |
Move constructor for when initialized with an rvalue Polynomial object.
ogn | The rvalue Polynomial object. |
|
noexcept |
Getter function for getting the degree of the Polynomial.
|
noexcept |
Calculus function for getting the derivative of the Polynomial.
|
noexcept |
Getter function for getting the expression of the Polynomial.
|
noexcept |
Calculus function for getting the integral of the Polynomial.
|
noexcept |
Getter function for getting the monomials of the Polynomial.
|
noexcept |
Calculus function for getting all the real and complex roots of the Polynomial using the Eigen library.
Does not handle the edge case when called with a constant polynomial (polynomial of degree zero).
|
noexcept |
Calculus function for getting the value of the Polynomial at a point.
x | The point to evaluate. |
|
noexcept |
|
noexcept |
Not equal logic operator overload.
ogn | The Polynomial object to compare to. |
|
noexcept |
Modulus operator overload.
ogn | The Polynomial object to divide by. |
|
noexcept |
Modulus assigment operator overload.
ogn | The Polynomial object to divide by. |
|
noexcept |
Multiplication operator overload.
ogn | The Polynomial object to multiply by. |
|
noexcept |
Multiplication assigment operator overload.
ogn | The Polynomial object to multiply by. |
|
noexcept |
Addition operator overload.
ogn | The Polynomial object to add. |
|
noexcept |
Addition assigment operator overload.
ogn | The Polynomial object to add. |
|
noexcept |
Substraction operator overload.
ogn | The Polynomial object to substract by. |
|
noexcept |
Substraction assigment operator overload.
ogn | The Polynomial object to substract by. |
|
noexcept |
Division operator overload.
ogn | The Polynomial object to divide by. |
|
noexcept |
Division assigment operator overload.
ogn | The Polynomial object to divide by. |
Definition at line 412 of file emath.cpp.
References emth::Monomial::get_degree().
|
noexcept |
Less than logic operator overload.
ogn | The Polynomial object to compare to. |
|
noexcept |
Less or equal than logic operator overload.
ogn | The Polynomial object to compare to. |
|
noexcept |
Assigment operator overload for when called with an lvalue.
ogn | The lvalue Polynomial object. |
|
noexcept |
Move assigment operator overload for when called with an rvalue.
ogn | The rvalue Polynomial object. |
|
noexcept |
Equal logic operator overload.
ogn | The Polynomial object to compare to. |
|
noexcept |
Greater than logic operator overload.
ogn | The Polynomial object to compare to. |
|
noexcept |
Greater or equal than logic operator overload.
ogn | The Polynomial object to compare to. |
|
noexcept |
Function for appending a lvalue monomial to the Polynomial.
m | The Monomial object to append. |
|
noexcept |
Function for appending a rvalue monomial to the Polynomial.
m | The Monomial object to append. |
Definition at line 490 of file emath.cpp.
References emth::Monomial::get_coeff(), and emth::Monomial::get_degree().
|
friend |
A friend operator to insert the Polynomial into a std::ostream.
out | The std::ostream. |
m | The Polynomial object to insert. |
|
friend |
A friend operator to insert the Polynomial into a std::stringstream.
ss | The std::stringstream. |
m | The Polynomial object to insert. |