Skip to content

A multi-threaded program that calculates the convergence of a function based on user input. It uses pthreads to evaluate the function and displays the summation result.

Notifications You must be signed in to change notification settings

bl33h/convergenceCalculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

convergenceCalculator

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.


pic

FilesFeaturesHow To Use

Files

  • src: the file that implements de solution.
  • flowchart: flowchart: the model construction.

Features

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.

How To Use

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:

  1. Open Google Colab in your web browser.
  2. Click on "File" in the top menu, then select "Open notebook".
  3. In the "GitHub" tab, enter the repository URL: https://github.com/bl33h/convergenceCalculator
  4. Choose the desired notebook file and click "Open".
  5. 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.

About

A multi-threaded program that calculates the convergence of a function based on user input. It uses pthreads to evaluate the function and displays the summation result.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages