Root Finder  1.0
Using various numerical methods
Loading...
Searching...
No Matches
utils.h
Go to the documentation of this file.
1/*
2@Author: Gilbert Young
3@Time: 2024/09/19 01:47
4@File_name: utils.h
5@IDE: VSCode
6@Formatter: Clang-Format
7@Description: Declarations of utility functions for running methods and handling user input.
8*/
9
10#ifndef UTILS_H
11#define UTILS_H
12
13#include <string>
14#include <functional>
15#include <vector>
16#include <map>
17#include "methods.h"
18
19extern std::map<std::string, std::vector<RootInfo>> summary;
20
21// Function to run the method and display results
22void run_method(const std::string &method_name,
23 std::function<long double(long double, long double, long double, int, std::vector<std::string> &, int)> method_func,
24 long double a, long double b, long double tol, int max_iter,
25 int decimal_places);
26
27// Function to run the problem steps
29
30// Function to compare all methods
32
33// Function to get user input
34void get_user_input(long double &a, long double &b, long double &x0, std::string &method_name, long double &tol);
35
36// Function to calculate decimal places based on tolerance
37int calculate_decimal_places(long double tol);
38
39// Function to run the method and display results (for user-selected methods)
40void run_method_user_selection(const std::string &method_name,
41 std::function<long double(long double, long double, long double, int, std::vector<std::string> &, int)> method_func,
42 long double a, long double b, long double tol, int max_iter);
43
44#endif // UTILS_H
void run_method_user_selection(const std::string &method_name, std::function< long double(long double, long double, long double, int, std::vector< std::string > &, int)> method_func, long double a, long double b, long double tol, int max_iter)
Definition utils.cpp:305
std::map< std::string, std::vector< RootInfo > > summary
Definition utils.cpp:24
void compare_all_methods()
Definition utils.cpp:141
void run_method(const std::string &method_name, std::function< long double(long double, long double, long double, int, std::vector< std::string > &, int)> method_func, long double a, long double b, long double tol, int max_iter, int decimal_places)
Definition utils.cpp:27
void run_problem_steps()
Definition utils.cpp:58
void get_user_input(long double &a, long double &b, long double &x0, std::string &method_name, long double &tol)
Definition utils.cpp:234
int calculate_decimal_places(long double tol)
Definition utils.cpp:297