This project focuses on the numerical approximation of integrals using Chebyshev polynomials. It implements and compares the Trapezoidal and Simpson's methods for integral approximation.
- Implements numerical integration using Trapezoidal and Simpson's methods.
- Utilizes Chebyshev polynomials of the first and second kind.
- Includes error measurement and optimization techniques.
- Add the project folders to the MATLAB search path.
- Use functions (
trapezoidal,simpson) for approximate integral calculations of Chebyshev polynomials. In the project we providechebyshev_combinationfunction that represents polynomials in the form of:$$w_n(x) = \sum_{k=0}^n a_kT_k(x)U_k(x)$$ where$T_k$ is a Chebyshev polynomial of the first kind and$U_k$ - of the second kind. To usechebyshev_combinationwithtrapezoidal(similarlysimpson) use the following code (a - beggining of the integration interval, b - end of the integration interval, N - number of subintervals in the composite trapezoidal method, coefficients -$a_k$ coefficients for the Chebyshev polynomial):
result = trapezoidal(a, b, N, @chebyshev_combination, coefficients)- Use functions (
trapezoidal_general,simpson_general) for approximate integral calculations of any function$y = f(x)$ . For example
result = trapezoidal_general(a, b, N, @my_function)- Explore the GUI application
examplesGUI.mlappfor visual demonstration and comparison of aprroximate results with true integrals. - Explore the GUI application
errorsGUI.mlappfor error visualisations.
- Several examples (
chebyshev_example_1,chebyshev_example_2, etc.) are provided to demonstrate the effectiveness of the methods in different scenarios. See the report for full description of the examples.
- The project includes a detailed analysis of the errors associated with each method, including heat maps and relative error comparisons.
- One of the takeaways is that increasing the number of subintervals (hyperparameter N) for both methods decreases the relative error of the approximation.
Figure 1: Graph of the dependence of the relative error expressed in (%) on the number of subintervals in integration by the trapezoidal method
- Hubert Kowalski
- Adam Kaniasty
- 25.11.2023