A program that calculates the convergence of a function using multi-threading. It prompts the user to input the maximum value (n) for a series and then evaluates the function using pthreads. The convergenceEvaluation function is adapted to calculate the values of the function based on the input number. Finally, the program prints the result of the function's summation and terminates.
Files • Features • How To Use
- src: the file that implements de solution.
- flowchart: flowchart: the model construction.
The main features of the application include:
- Multi-threading: The code utilizes pthreads to create and manage multiple threads concurrently, allowing for parallel execution of the convergenceEvaluation function.
- User Input: The code prompts the user to input the maximum value (n) for the series, allowing customization and flexibility in evaluating the function.
- Function Evaluation: The code evaluates the convergence of a function using the convergenceEvaluation method, which calculates and returns the values based on the input number.
- Result Display: The code prints the result of the function's summation, providing the final outcome of the convergence calculation.
- Error Handling: The code includes error handling mechanisms, such as checking for thread creation errors (variable 'a') and handling memory allocation for the result pointer.
- Code Organization: The code follows a modular structure with clear comments and sections, making it easy to understand and maintain.
To clone and run this application, you'll need Git and a C++ compiler installed on your computer. From your command line:
# Clone this repository
$ git clone https://github.com/bl33h/convergenceCalculator
# Open the folder
$ cd src
# Run the app
$ g++ convergenceCalculator.cpp -o convergenceCalculator
$ ./convergenceCalculator
Alternatively, you can run the code using Google Colab:
- Open Google Colab in your web browser.
- Click on "File" in the top menu, then select "Open notebook".
- In the "GitHub" tab, enter the repository URL: https://github.com/bl33h/convergenceCalculator
- Choose the desired notebook file and click "Open".
- Follow the instructions within the Colab notebook to execute the code.
Note: Running the code in Google Colab requires an internet connection and a Google account. It provides a convenient online environment for executing code without the need for local setup or dependencies.