Hey everyone! This repository contains my progress on university tasks related to numerical methods. I hope you'll find something useful here!
Write a program to calculate the condition number of a square matrix, using norms:
The calculation of an inverse matrix should include LU-decomposition. Find the condition number of matrices following this pattern:
Ensure that the inverse matrix is tridiagonal, with non-diagonal elements:
and diagonal elements:
Plot the dependence of the calculation time of the inverse matrix on the size of the matrix.
The Task 1
directory contains 4 files:
external.py
cond_num.py
results.csv
one_minute.png
external.py
contains 8 functions that run the entire process:
generate_matrix
: generates the matrix according to the taskmatrix_multiplication
: multiplies two matrices using the basic algorithmlu_decompose
: decomposes a matrix according to the Gaussian algorithm of LU-decompositioninvert
: returns the inverse matrixnorm_1
,norm_inf
,norm_euclid
: calculate 3 kinds of norms of a matrixcondition_numbers
: returns three condition numbers for each kind of norm
cond_num.py
is the main program that accomplishes the task. It retrieves the condition numbers and plots the dependency.
results.csv
is the file with those particular condition numbers.
one_minute.png
is the actual plot of the time and size relation.
The execution time of the program is limited by the number of minutes mentioned at the beginning (this number could be a float).
Plato.png
is a screenshot of a plateau during a one-minute test.
Write a program that implements the approximate solution of a system of linear algebraic equations using Seidel's method. Use the program to find the solution of the following system:
where elements of A are:
and elements of f are:
The accurate solution is:
Explore the dependence of the iteration count on n and
and plot the convergence graphs.
Let
where D is a diagonal matrix with diagonal elements of A,
L is a lower triangle matrix with the elements from A, that are under the main diagonal.
In the alternating triangular preconditioning method, the preconditioner 𝐵 is defined as
Write a program to solve a system of linear algebraic equations with a symmetric positive definite matrix using the alternating triangular method with the choice of iteration parameters according to
Study the convergence rate of this iterative method depending on the parameter 𝜔 in the problem
with Hilbert matrix
and the right side
for which the exact solution is
The solution is contained in Task 2/ Part 1
and there are 3 files:
src
- the directory containing the picture of the resulting plotsexternal.py
- the file, which is used more like as a package that consists of functionsgenerate_input
- generates the matrix of coeficinents and right-side vectorseidel
- the function implementing the Seidel's iterative method
seidel_main.py
- the main program that accomplishes the task