Exponential Functions
Loading...
Searching...
No Matches
JRAMPERSAD::EXPONENTIAL::Function Class Reference

class representing an Exponential Function (e.g 2x^2 + 4x - 1) More...

#include <Exponential.h>

Public Member Functions

 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.
 
Functionoperator= (const Function &other)=default
 Copy Assignment operator.
 
Functionoperator= (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.
 
Functionoperator*= (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
 

Friends

std::vector< double > QuadraticSolve (const Function &f)
 Uses the quadratic function to solve the roots of an entered quadratic equation.
 
std::ostream & operator<< (std::ostream &os, const Function func)
 
Function operator+ (const Function &f1, const Function &f2)
 
Function operator- (const Function &f1, const Function &f2)
 
Function operator* (const Function &f, const int64_t &c)
 

Detailed Description

class representing an Exponential Function (e.g 2x^2 + 4x - 1)

Constructor & Destructor Documentation

◆ Function()

JRAMPERSAD::EXPONENTIAL::Function::Function ( const unsigned short &  Lrgst_expo)
inline

Constructor for Function class.

Parameters
Lrgst_expoThe largest exponent in the function (e.g 2 means largest exponent is x^2)

Member Function Documentation

◆ 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
optionsGA_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
Returns
lrgst_expo

◆ 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
constntsAn 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
constntsAn 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_valThe return value that you would like to find the approximate x values needed to solve when entered into the function
optionsGA_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_valthe X Value you'd like the function to use
Returns
the Y value the function returns based on the entered X value

Friends And Related Symbol Documentation

◆ operator*

Function operator* ( const Function f,
const int64_t &  c 
)
friend

Operator to multiply a function by a constant (Scaling it)

◆ operator+

Function operator+ ( const Function f1,
const Function f2 
)
friend

Operator to add two functions

◆ operator-

Function operator- ( const Function f1,
const Function f2 
)
friend

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
fQuadratic 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: