Web application for running numerical methods that solve:
-
Equations in one variable (such as the Newton–Raphson method)
-
Linear systems of equations (such as the Gauß–Seidel iterative technique)
-
As well as interpolation (such as the Lagrange interpolating polynomial)
- 1. Table of contents
- 2. Methods we support
- 3. Features
- 4. Limitations
- 5. Screenshots
- 6. Expected input and output formats
- 7. Methods comparison feature
- 8. Internal representation
- 9. User interaction
- 10. Quirks
- 11. Run
- 12. About this project
- 13. References
- 14. Authors
- 15. Similar projects
- 16. License
… [W]e consider one of the most basic problems of numerical approximation, the root-finding problem. This process involves finding a root, or solution, of an equation of the form
$f(x) = 0$ , for a given function$f$ . A root of this equation is also called a zero of the function$f$ .—Burden & Faires (2011, p. 48)
- Bisection method
- Fixed-point iteration
- Newton–Raphson method
- Secant method
- The method of false position (also known as regula falsi)
- Modified Newton method for multiple roots (at least one of the following):
- Accounting for root multiplicity
- Using an auxiliary function
Direct techniques are methods that theoretically give the exact solution to the system in a finite number of steps. In practice, of course, the solution obtained will be contaminated by the round-off error that is involved with the arithmetic being used.
—Burden & Faires (2011, p. 358)
An iterative technique to solve the
$n \times n$ linear system$A \vec{x} = \vec{b}$ starts with an initial approximation$\vec{x}^{(0)}$ to the solution$\vec{x}$ and generates a sequence of vectors${{\vec{x}^{(k)}}}^{\infty}_{k=0}$ that converges to$\vec{x}$ .—Burden & Faires (2011, p. 450)
Though the course covered direct techniques, this program only implements these iterative techniques:
-
Jacobi iterative method
-
Gauß–Seidel iterative technique
-
Successive Over-Relaxation (also known as SOR)
Note: Our program is designed to solve systems of
The problem of determining a polynomial of degree one that passes through the distinct points
$(x_0, y_0)$ and$(x_1, y_1)$ is the same as approximating a function$f$ for which$f (x_0) = y_0$ and$f (x_1) = y_1$ by means of a first-degree polynomial interpolating, or agreeing with, the values of$f$ at the given points. Using this polynomial for approximation within the interval given by the endpoints is called polynomial interpolation.—Burden & Faires (2011, p. 108)
-
Vandermonde polynomial
-
Newton's divided differences interpolation polynomial
-
Lagrange polynomial
-
Linear spline interpolation
-
Cubic spline interpolation
Note: Our program is designed to interpolate a maximum of 8 data points.
-
User help system: By this we mean that the program tries its best to validate user input and, in case of error, notify what exactly went wrong. (Instead of saying "yeah, this just didn't work
¯\_(ツ)_/¯
").For example, if a given function, a typical input, turns out not to be continuous —if an intermediate result had an imaginary part, for instance— for a method that requires continuity, we would notify the user.
"Your function might not be continuous in this interval"
-
Solution graphing: If a solution was found, the program will graph the function (for methods that work with functions, naturally) around the interval where the solution was found. This feature helps verify the correctness of the program, though a visual proof is no real guarantee of correctness.
-
Methods comparison: Each semester, our professor adds in another requirement, so as to discourage, nay, avoid blind copy-paste, or fork, of repositories created by students who have already taken the course.
This semester, the "one more thing" for this project is a methods comparison feature. After running each method, the program runs the other methods on the same inputs and provides a table with relevant variables. These include the number of iterations, final error (be it absolute or relative), and, if found, a solution.
After running all the relevant methods, the program decides which one is best based on criteria defined by us, the programmers.
- Exclusive operation on the real numbers: We are not working with numerical methods that can find e.g. roots in the complex numbers. This program will not return answers that lie in the complex numbers (i.e. have an imaginary part).
Warning
This section is pending.
It's supposed to talk about the inputs and outputs for each section. It should also talk about input validation (specially for the section on linear systems).
Warning
This section is pending.
Warning
This section is pending.
Warning
This section is pending.
(The little note below had to go somewhere.)
Besides the data points, the user must provide an additional data point that will be used to calculate the error.
As mentioned above in § 3. Features, the methods comparison feature provides a table with relevant variables.
For the section on equations in one variable, this table follows the format (and please note that the numerical values are dummy data that might not make sense):
Method | |||
---|---|---|---|
Bisection | 2.3844e-15 | 7 | 3.1e-15 |
Newton–Raphson | 2.3844e-15 | 3 | 3.0e-15 |
and other methods | … | … | … |
If a method works on an initial value, instead of an interval, the program sets up an interval to work with, and vice versa.
For the section on iterative techniques to solve linear systems, this table follows the format (and note the same caveat as indicated above):
Method | … | |||||
---|---|---|---|---|---|---|
Jacobi | 10 | 2.3844e-15 | … | … | … | 5.1e-11 |
Gauß–Seidel | 5 | 2.3344e-15 | … | … | … | 3.0e-14 |
SOR₁ | 4 | 2.3444e-15 | … | … | … | 4.0e-12 |
SOR₂ | 6 | 2.3544e-15 | … | … | … | 3.3e-13 |
SOR₃ | 2 | 2.3944e-15 | … | … | … | 4.2e-16 |
Where SOR has three methods that correspond to three arbitrary values, chosen by
us, the programmers, of the
---
title: Internal representation of numerical methods
theme: neutral
---
classDiagram
class NumericalMethod {
<<abstract>>
+str name
+MethodRun method_run
+MethodRun run()
}
%% not entirely happy with the name %%
class MethodRun {
+ErrorReason error
+datetime run_time
+Result result
+bool has_run()
+bool was_successful()
}
class Result {
+ResultStatus result_status
+int execution_time_ms
}
class ResultStatus {
<<enumeration>>
NO_STATUS
FAILED
INTERRUPTED
IN_PROGRESS
SUCCESSFUL
}
NumericalMethod --|> MethodRun
MethodRun --|> Result
Result --|> ResultStatus
---
title: User interaction with the website
theme: neutral
---
graph TD
%% Let us define the nodes first %%
start@{ shape: manual, label: "Choose a numerical method"}
user_input@{shape: manual-input, label: "Input parameters"}
input_validation@{shape: subprocess, label: "Validate input"}
input_error_message["Notify of invalid input"]
method_run@{shape: process, label: "Run method"}
error_show@{shape: display, label: "Notify of error"}
results_show@{shape: display, label: "Show results"}
plot@{shape: display, label: "Show plot"}
comparison_feature@{shape: display, label: "Show comparison report"}
%% And now for the edges %%
start --> user_input
user_input --> input_validation
input_validation --> was_good_input{Valid?}
was_good_input --> |Yes| method_run
was_good_input --> |No| input_error_message
input_error_message -.-> user_input
method_run --> was_method_successful{Is run OK?}
was_method_successful --> |Yes| results_show
results_show -.-> plot
was_method_successful --> |No| error_show
plot --> wants_comparison{Comparison?}
wants_comparison --> |Yes| comparison_feature
This section states the problems that we, or the professor, found in our project.
As of commit dea96f
, our program (specifically, the Jacobi method
implementation) incorrectly reports a matrix to be "non-invertible" even though
it might have an inverse.
For example, the following matrix
Our program, however, shows this error message:
Matrix A is singular (non-invertible). Please check the matrix and try again.
This an implementation error where we compute the inverse of the diagonal matrix
numerical-methods/linear_systems/jacobi.py
Lines 55 to 60 in dea96f8
Our report for the interpolation section only prints the polynomials generated with each method:
numerical-methods/interpolation/report.py
Lines 32 to 36 in dea96f8
It does not, however, ask for another data point so that the function might get evaluated at that point and see how far it was from the actual value in each method.
At the end of each "Equations in one variable" method, we graphed the function
using a common utility function that received, besides a function (as an str
),
two optional parameters for the min_value
and max_value
of the graph's
Instead of passing in the endpoints for the interval
numerical-methods/utils/interface_blocks.py
Lines 74 to 82 in dea96f8
This has two uncomfortable implications:
-
If the
$[a,b]$ interval is too far off the restricted actual interval we care for, the graph (or "plot") turns out to be mostly useless. -
If we were to pass a
min_value
andmax_value
in such a way that the amplitude of the interval approached, or even exceeded, that of the 1000 sample points we are using, the graph would resemble a scatterplot, rather than a continuous function.
Warning
This section is incomplete.
It's meant to explain how to setup and run the website, as well as any requirements (operating system, memory, other programs, environment variables, etc.)
pip install -r requirements.txt
streamlit run Main.py
This is the course project for the course "Análisis numérico" (ST0256) taught by professor Julián Esteban Rendón-Roldán at EAFIT University in Medellín, Colombia.
-
Burden, Richard L., and J. Douglas Faires. Numerical Analysis. 9. ed., International ed, Brooks/Cole, 2011.
Course textbook. Chapter 2 covers solutions of equations in one variable. Chapters 6 and 7 cover direct and iterative methods, respectively, for solving linear systems. Chapter 3 covers interpolation.
-
Correa Zabala, Francisco José. Métodos numéricos. 2010. 1st ed., Fondo Editorial Universidad Eafit, 2018.
Another course textbook. This one doesn't get mentioned too often, but it's the basis material for the course slides.
Jerónimo Acosta Acevedo and Luis Miguel Torres Villegas.
-
nceballosp/Analisis-Numerico. Python + Flask and Vite + React.
-
isabelmorar/AnalisisNumerico. Python + Django.
-
EAZ-EAFIT/Moscow-Mathematical-Papyrus. Python + Streamlit.
-
alejoriosm04/NumeriSketch. Python + Django.
Copyright really unclear.