Least Squares is a numerical method implementation for polynomial approximation. This library provides a convenient way to perform polynomial approximation using the least squares method.
- Read data from a file
- Perform least squares approximation for a given degree polynomial
- Print the polynomial coefficients
To use the Least Squares library, follow these steps:
-
Clone the repository:
git clone https://github.com/username/least-squares.git
-
Build the project:
cd least-squares make
To use the Least Squares library in your C++ project, follow these steps:
-
Create an instance of the
LeastSquares
class, providing the name of the data file:#include "LeastSquares.hpp" int main() { least_squares::LeastSquares ls("data.txt"); // Perform least squares approximation for a polynomial of degree 3 ls.least_squares_implementation(3); // Print the polynomial coefficients ls.printf_polynomial(); return 0; }
-
Compile and run the program:
g++ main.cpp -o app ./app
Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.
This project is licensed under the GPL-3.0 License.