76 std::cerr <<
"033[31Caught error: For Bisection method, function values at initial points must have "
78 std::cerr <<
"033[31f(" <<
initial_point <<
") = " << f_a <<
"\n";
79 std::cerr <<
"033[31f(" <<
final_point <<
") = " << f_b <<
"\n";
81 std::exit(EXIT_FAILURE);
140 double initial_point,
double final_point,
bool verbose) {
145 this->initial_point1 = initial_point;
146 this->initial_point2 = final_point;
Configuration (data) class for the Bisection method.
Definition config.hpp:48
double final_point
The final point of the interval.
Definition config.hpp:51
BisectionConfig(double tolerance, int max_iterations, bool aitken, std::function< double(double)> function, double initial_point, double final_point, bool verbose)
Constructor for BisectionConfig.
Definition config.hpp:62
double initial_point
The initial point of the interval.
Definition config.hpp:50
Configuration (data) class for the Secant method.
Definition config.hpp:125
ChordsConfig(double tolerance, int max_iterations, bool aitken, std::function< double(double)> function, double initial_point, double final_point, bool verbose)
Constructor for SecantConfig.
Definition config.hpp:139
double initial_point1
The initial point of the interval.
Definition config.hpp:127
double initial_point2
The final point of the interval.
Definition config.hpp:128
Base (shared) configuration (data) class for root-finding methods.
Definition config.hpp:27
Method method
The root-finding method to be used.
Definition config.hpp:34
bool aitken
Indicates whether Aitken acceleration is enabled.
Definition config.hpp:37
std::function< double(double)> function
The function for which the root is to be found.
Definition config.hpp:39
double tolerance
The tolerance for convergence.
Definition config.hpp:35
int max_iterations
The maximum number of iterations allowed.
Definition config.hpp:36
bool verbose
Indicates whether verbose output is enabled.
Definition config.hpp:38
virtual ~ConfigBase()
Virtual destructor required for downcasting objects to derived class types (using dynamic_cast).
Definition config.hpp:33
Configuration (data) class for the Fixed Point method.
Definition config.hpp:158
std::function< double(double)> g_function
The g function for the Fixed Point method.
Definition config.hpp:161
double initial_guess
The initial guess for the root.
Definition config.hpp:160
FixedPointConfig(double tolerance, int max_iterations, bool aitken, std::function< double(double)> function, double initial_guess, std::function< double(double)> g_function, bool verbose)
Constructor for FixedPointConfig.
Definition config.hpp:172
Configuration (data) class for the Newton method.
Definition config.hpp:92
std::function< double(double)> derivative
The derivative of the function.
Definition config.hpp:95
NewtonConfig(double tolerance, int max_iterations, bool aitken, std::function< double(double)> function, std::function< double(double)> derivative, double initial_guess, bool verbose)
Constructor for NewtonConfig.
Definition config.hpp:106
double initial_guess
The initial guess for the root.
Definition config.hpp:94
Method
Enumeration of available root-finding methods.
Definition method.hpp:8
@ FIXED_POINT
Definition method.hpp:8
@ BISECTION
Definition method.hpp:8
@ CHORDS
Definition method.hpp:8
@ NEWTON
Definition method.hpp:8