Exponential Functions
Loading...
Searching...
No Matches
JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo > Class Template Reference

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

#include <Exponential.h>

Public Member Functions

 Function (const std::vector< int > &constnts)
 Constructor for Function class.
 
 Function (std::vector< int > &&constnts)
 Constructor for Function class.
 
 Function (const Function &other)=default
 
 Function (Function &&other) noexcept=default
 
Functionoperator= (const Function &other)=default
 
Functionoperator= (Function &&other) noexcept=default
 
Function< lrgst_expo > & operator*= (const int &c)
 
Function< lrgst_expo - 1 > differential () const
 Calculates the differential (dy/dx) of the function.
 
std::vector< doubleget_real_roots (const GA_Options &options=GA_Options()) const
 Function that uses a genetic algorithm to find the approximate roots of the function.
 
double solve_y (const double &x_val) const noexcept
 Function that solves for y when x = user value.
 
std::vector< doublesolve_x (const double &y_val, const GA_Options &options=GA_Options()) const
 Function that uses a genetic algorithm to find the values of x where y = user value.
 

Friends

std::vector< doubleQuadraticSolve (const Function< 2 > &f)
 Uses the quadratic function to solve the roots of an entered quadratic equation.
 
std::ostream & operator<< (std::ostream &os, const Function< lrgst_expo > func)
 
template<int e1, int e2, int r>
Function< roperator+ (const Function< e1 > &f1, const Function< e2 > &f2)
 
template<int e1, int e2, int r>
Function< roperator- (const Function< e1 > &f1, const Function< e2 > &f2)
 
Function< lrgst_expooperator* (const Function< lrgst_expo > &f, const int &c)
 

Detailed Description

template<int lrgst_expo>
class JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >

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

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

Constructor & Destructor Documentation

◆ Function() [1/2]

template<int lrgst_expo>
JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >::Function ( const std::vector< int > &  constnts)

Constructor for Function class.

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

◆ Function() [2/2]

template<int lrgst_expo>
JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >::Function ( std::vector< int > &&  constnts)

Constructor for Function class.

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

Member Function Documentation

◆ differential()

template<int lrgst_expo>
Function< lrgst_expo - 1 > JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >::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()

template<int lrgst_expo>
std::vector< double > JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >::get_real_roots ( const GA_Options options = GA_Options()) const

Function that 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)

◆ solve_x()

template<int lrgst_expo>
std::vector< double > JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >::solve_x ( const double y_val,
const GA_Options options = GA_Options() 
) const
inline

Function that 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()

template<int lrgst_expo>
double JRAMPERSAD::EXPONENTIAL::Function< lrgst_expo >::solve_y ( const double x_val) const
noexcept

Function that 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

◆ QuadraticSolve

template<int lrgst_expo>
std::vector< double > QuadraticSolve ( const Function< 2 > &  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<2> object
Returns
a vector containing the roots

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