class representing an Exponential Function (e.g 2x^2 + 4x - 1)
More...
#include <Exponential.h>
|
| Function (const unsigned short &Lrgst_expo) |
| Constructor for Function class.
|
|
virtual | ~Function () |
| Destructor.
|
|
| Function (const Function &other)=default |
| Copy Constructor.
|
|
| Function (Function &&other) noexcept=default |
| Move Constructor.
|
|
Function & | operator= (const Function &other)=default |
| Copy Assignment operator.
|
|
Function & | operator= (Function &&other) noexcept=default |
| Move Assignment operator.
|
|
void | SetConstants (const std::vector< int64_t > &constnts) |
| Sets the constants of the function.
|
|
void | SetConstants (std::vector< int64_t > &&constnts) |
| Sets the constants of the function.
|
|
Function & | operator*= (const int64_t &c) |
|
Function | differential () const |
| Calculates the differential (dy/dx) of the Function.
|
|
std::vector< double > | get_real_roots (const GA_Options &options=GA_Options()) const |
| Uses a genetic algorithm to find the approximate roots of the function.
|
|
double | solve_y (const double &x_val) const |
| Solves for y when x = user value.
|
|
std::vector< double > | solve_x (const double &y_val, const GA_Options &options=GA_Options()) const |
| Uses a genetic algorithm to find the values of x where y = user value.
|
|
auto | GetWhatIsTheLargestExponent () const |
|
class representing an Exponential Function (e.g 2x^2 + 4x - 1)
◆ Function()
JRAMPERSAD::EXPONENTIAL::Function::Function |
( |
const unsigned short & |
Lrgst_expo | ) |
|
|
inline |
Constructor for Function class.
- Parameters
-
Lrgst_expo | The largest exponent in the function (e.g 2 means largest exponent is x^2) |
◆ differential()
Function JRAMPERSAD::EXPONENTIAL::Function::differential |
( |
| ) |
const |
Calculates the differential (dy/dx) of the Function.
- Returns
- a Function representing the differential (dy/dx) of the calling function object
◆ get_real_roots()
std::vector< double > JRAMPERSAD::EXPONENTIAL::Function::get_real_roots |
( |
const GA_Options & |
options = GA_Options() | ) |
const |
Uses a genetic algorithm to find the approximate roots of the function.
- Parameters
-
options | GA_Options object specifying the options to run the algorithm |
- Returns
- A vector containing a n number of approximate root values (n = sample_size as defined in options)
◆ GetWhatIsTheLargestExponent()
auto JRAMPERSAD::EXPONENTIAL::Function::GetWhatIsTheLargestExponent |
( |
| ) |
const |
|
inline |
◆ operator*=()
Function & JRAMPERSAD::EXPONENTIAL::Function::operator*= |
( |
const int64_t & |
c | ) |
|
Operator to multiply a function by a constant (Scaling it)
◆ SetConstants() [1/2]
void JRAMPERSAD::EXPONENTIAL::Function::SetConstants |
( |
const std::vector< int64_t > & |
constnts | ) |
|
Sets the constants of the function.
- Parameters
-
constnts | An array with the constants for the function (e.g 2, 1, 3 = 2x^2 + 1x - 3) size of array MUST be lrgst_expo + 1 |
◆ SetConstants() [2/2]
void JRAMPERSAD::EXPONENTIAL::Function::SetConstants |
( |
std::vector< int64_t > && |
constnts | ) |
|
Sets the constants of the function.
- Parameters
-
constnts | An array with the constants for the function (e.g 2, 1, 3 = 2x^2 + 1x - 3) size of array MUST be lrgst_expo + 1 |
◆ solve_x()
std::vector< double > JRAMPERSAD::EXPONENTIAL::Function::solve_x |
( |
const double & |
y_val, |
|
|
const GA_Options & |
options = GA_Options() |
|
) |
| const |
|
inline |
Uses a genetic algorithm to find the values of x where y = user value.
- Parameters
-
y_val | The return value that you would like to find the approximate x values needed to solve when entered into the function |
options | GA_Options object specifying the options to run the algorithm |
- Returns
- A vector containing a n number of x values that cause the function to approximately equal the y_val (n = sample_size as defined in options)
◆ solve_y()
double JRAMPERSAD::EXPONENTIAL::Function::solve_y |
( |
const double & |
x_val | ) |
const |
Solves for y when x = user value.
- Parameters
-
x_val | the X Value you'd like the function to use |
- Returns
- the Y value the function returns based on the entered X value
◆ operator*
Operator to multiply a function by a constant (Scaling it)
◆ operator+
Operator to add two functions
◆ operator-
Operator to subtract two functions
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & |
os, |
|
|
const Function |
func |
|
) |
| |
|
friend |
Operator function to display function object in a human readable format
◆ QuadraticSolve
std::vector< double > QuadraticSolve |
( |
const Function & |
f | ) |
|
|
friend |
Uses the quadratic function to solve the roots of an entered quadratic equation.
- Parameters
-
f | Quadratic function you'd like to find the roots of (Quadratic Function object is a Function object who's lrgst_expo value = 2 |
- Returns
- a vector containing the roots
The documentation for this class was generated from the following file: