Compare commits

...
22 Commits
Author SHA1 Message Date
stud128245 3c44ed2bac Merge pull request 'Добавление информации о методах (№1)' (#2) from dev into master
Reviewed-on: #2
2023-10-27 08:28:22 +00:00
stud128245 9492ee20b1 Merge branch 'master' into dev 2023-10-27 08:27:04 +00:00
AVAtarMod 52cdcfbade Merge workspace from dev 2023-10-27 11:23:10 +03:00
AVAtarMod 3fad2bd5dd Merge config.tex from dev 2023-10-27 11:20:59 +03:00
AVAtarMod 6dab995e76 [presentation] Add image 2023-10-27 10:46:47 +03:00
AVAtarMod ef87c08cb5 [presentation] Add content 2023-10-18 21:49:33 +03:00
AVAtarMod b8636adb4c Update workspace 2023-10-18 21:49:06 +03:00
AVAtarMod 8e9ca19f17 [content] Fix Appendix links 2023-10-18 21:48:53 +03:00
AVAtarMod 99756b48de assets: Move images, update logos 2023-10-18 13:20:50 +03:00
AVAtarMod 5c3084deeb [content] Add program development chapter, Fix refs 2023-10-17 23:50:26 +03:00
AVAtarMod 29ef7018a5 [soures] sort, add items 2023-10-17 23:48:40 +03:00
AVAtarMod 63d5668224 [config] Add cyrrilic support in listings 2023-10-17 23:47:58 +03:00
AVAtarMod cba0a8514d [content] Add conclustion 2023-10-17 23:47:34 +03:00
AVAtarMod c1ee0fe5ce [content] Add appendix 2023-10-17 23:47:23 +03:00
AVAtarMod a25e301f1e Update workspace 2023-10-17 23:47:02 +03:00
AVAtarMod a2d84c7583 [content] Fix matrix, split chapters at end 2023-10-17 23:46:46 +03:00
AVAtarMod 4ad96347fb assets: Add images 2023-10-17 20:58:52 +03:00
AVAtarMod b39269901c [code] Add Approx 2023-10-17 20:58:31 +03:00
AVAtarMod 6dce1980d7 Fix merge conflict (pre-PR merge) 2023-08-24 22:10:57 +03:00
AVAtarMod 1285da87e5 config: Update math symbos, style
- Replace quotation marks symbols to <<, >>
- Fix TOC, itemize list style
2023-08-22 14:36:50 +03:00
AVAtarMod 2f25ade43e Update workspace files 2023-08-19 19:41:11 +03:00
stud128245 897e02bcd0 Merge pull request 'Исправление замечаний (№1)' (#1) from dev into master
Reviewed-on: #1
2023-08-15 10:09:04 +00:00
24 changed files with 597 additions and 81 deletions
+9 -6
View File
@@ -13,6 +13,12 @@
"pdflatex" "pdflatex"
] ]
}, },
{
"name": "latexmk (xelatex)",
"tools": [
"xelatexmk"
]
},
{ {
"name": "latexmk", "name": "latexmk",
"tools": [ "tools": [
@@ -34,12 +40,6 @@
"pdflatex" "pdflatex"
] ]
}, },
{
"name": "tectonic",
"tools": [
"tectonic"
]
}
], ],
"latex-workshop.latex.tools": [ "latex-workshop.latex.tools": [
{ {
@@ -50,6 +50,7 @@
"-interaction=nonstopmode", "-interaction=nonstopmode",
"-file-line-error", "-file-line-error",
"-pdf", "-pdf",
"-shell-escape",
"-outdir=%OUTDIR%", "-outdir=%OUTDIR%",
"%DOC%" "%DOC%"
], ],
@@ -81,6 +82,7 @@
"command": "pdflatex", "command": "pdflatex",
"args": [ "args": [
"-synctex=1", "-synctex=1",
// "-recorder",
"-shell-escape", "-shell-escape",
"-interaction=nonstopmode", "-interaction=nonstopmode",
"-file-line-error", "-file-line-error",
@@ -109,5 +111,6 @@
} }
], ],
"latex-workshop.latex.rootFile.indicator": "\\begin{document}", "latex-workshop.latex.rootFile.indicator": "\\begin{document}",
"latex-workshop.latex.recipe.default": "lastUsed",
} }
} }
+48 -3
View File
@@ -14,6 +14,51 @@
\addcontentsline{toc}{chapter}{Приложения} \addcontentsline{toc}{chapter}{Приложения}
\appendix \appendix
% \section{Скрипты установки БД для компонента <<Хранение~данных>>}
% \label{script:storage} \section{Результаты вывода программы}
% \inputcode{../software/architecture/first-level/component-storage/CSt.db-script.sql}{frame=none,language=sql} \label{output_program}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/Thomas}
\caption{Вывод программы для решения СЛУ методом прогонки}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/Inverted}
\caption{Вывод программы для решения СЛУ методом обратной матрицы}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/lagrange}
\caption{График интерполяции функции методом Лагранжа}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/newton}
\caption{График интерполяции функции методом Ньютона}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/CubicSpline}
\caption{График сплайн-интерполяции функции с помощью \textbf{CubicSpline}}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/PchipInterpolator}
\caption{График сплайн-интерполяции функции с помощью \textbf{PchipInterpolator}}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/CubicHermiteSpline}
\caption{График сплайн-интерполяции функции с помощью \textbf{CubicHermiteSpline}}
\end{figure}
\begin{figure}[H]
\centering
\includegraphics[width=0.6\textwidth]{assets/Akima1DInterpolator}
\caption{График сплайн-интерполяции функции с помощью \textbf{Akima1DInterpolator}}
\end{figure}
\section{Листинг программы}
\label{program_code}
\inputcode{code/main.py}{frame=none,language=python}
Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

+220 -16
View File
@@ -16,16 +16,16 @@ def plt_append(sp, x: list[float], y: list[float], label: str, format: str):
sp.plot(x, y, format, label=label) sp.plot(x, y, format, label=label)
def generate_array(min, max, density=10):
point_count = int(m.fabs(max-min)*density)
x = np.linspace(min, max, point_count)
return list(x.tolist())
class NonLinear: class NonLinear:
bisect_exp = "x**2 * np.sin(x)" bisect_exp = "x**2 * np.sin(x)"
newton_exp = "np.sin(x) * np.sqrt(np.abs(x))" newton_exp = "np.sin(x) * np.sqrt(np.abs(x))"
@staticmethod
def generate_array(min, max):
point_count = int(m.fabs(max-min))*10
x = np.linspace(min, max, point_count)
return list(x.tolist())
@staticmethod @staticmethod
def slice_array(range: list[float], val_min, val_max): def slice_array(range: list[float], val_min, val_max):
def index_search(range: list[float], val): def index_search(range: list[float], val):
@@ -54,7 +54,7 @@ class NonLinear:
def plot_bisect(): def plot_bisect():
bounds = 0, 6 bounds = 0, 6
split_val = 1 split_val = 1
x1 = NonLinear.generate_array(bounds[0], bounds[1]) x1 = generate_array(bounds[0], bounds[1])
x2 = NonLinear.slice_array(x1, split_val, None) x2 = NonLinear.slice_array(x1, split_val, None)
sp = create_subplot() sp = create_subplot()
@@ -65,9 +65,9 @@ class NonLinear:
plt_append( plt_append(
sp, x1, sol1[0], f"Исходные данные (y={NonLinear.bisect_exp})", "-b") sp, x1, sol1[0], f"Исходные данные (y={NonLinear.bisect_exp})", "-b")
plt_append( plt_append(
sp, *(sol1[1]), f"bisect at [{bounds[0]},{bounds[1]}]", "or") sp, *(sol1[1]), f"bisect на [{bounds[0]},{bounds[1]}]", "or")
plt_append( plt_append(
sp, *(sol2[1]), f"bisect at [{split_val},{bounds[1]}]", "og") sp, *(sol2[1]), f"bisect на [{split_val},{bounds[1]}]", "og")
sp.set_title("scipy.optimize.bisect") sp.set_title("scipy.optimize.bisect")
sp.legend(loc='lower left') sp.legend(loc='lower left')
@@ -84,7 +84,7 @@ class NonLinear:
def plot_newton(): def plot_newton():
bounds = -2, 7 bounds = -2, 7
split_l, split_r = 2, 5 split_l, split_r = 2, 5
x1 = NonLinear.generate_array(bounds[0], bounds[1]) x1 = generate_array(bounds[0], bounds[1])
x2 = NonLinear.slice_array(x1, split_l, split_r) x2 = NonLinear.slice_array(x1, split_l, split_r)
x0_1, x0_2 = 1/100, 4 x0_1, x0_2 = 1/100, 4
sp = create_subplot() sp = create_subplot()
@@ -95,9 +95,9 @@ class NonLinear:
plt_append( plt_append(
sp, x1, sol1[0], f"Исходные данные (y={NonLinear.newton_exp})", "-b") sp, x1, sol1[0], f"Исходные данные (y={NonLinear.newton_exp})", "-b")
plt_append( plt_append(
sp, *(sol1[1]), f"newton at [{bounds[0]},{bounds[1]}]", "or") sp, *(sol1[1]), f"newton на отрезке [{bounds[0]},{bounds[1]}]", "or")
plt_append( plt_append(
sp, *(sol2[1]), f"newton at [{split_l},{bounds[1]}]", "og") sp, *(sol2[1]), f"newton на отрезке [{split_l},{bounds[1]}]", "og")
sp.set_title("scipy.optimize.newton") sp.set_title("scipy.optimize.newton")
sp.legend(loc='lower left') sp.legend(loc='lower left')
@@ -137,7 +137,8 @@ class SLE:
new_data = [] new_data = []
new_len = len(data[0][0]) new_len = len(data[0][0])
zipped = list(zip(*tuple(data[0]))) zipped = list(zip(*tuple(data[0])))
zipped[len(zipped)-1] = (zipped[len(zipped)-1][0],zipped[len(zipped)-2][1]) zipped[len(zipped)-1] = (zipped[len(zipped)-1]
[0], zipped[len(zipped)-2][1])
complement_to = new_len - len(zipped[0]) complement_to = new_len - len(zipped[0])
for i, val in enumerate(zipped): for i, val in enumerate(zipped):
zero_r = complement_to - i zero_r = complement_to - i
@@ -159,7 +160,7 @@ class SLE:
if coef != 0: if coef != 0:
print(f"({coef}{SLE.var_str(i_coef)}) + ", end='') print(f"({coef}{SLE.var_str(i_coef)}) + ", end='')
else: else:
print(f" {coef} + ",end='') print(f" {coef} + ", end='')
print(f"({val[-1]}{SLE.var_str(len(val)-1)})", end='') print(f"({val[-1]}{SLE.var_str(len(val)-1)})", end='')
print(f" = {data[1][i]}") print(f" = {data[1][i]}")
@@ -213,12 +214,215 @@ class SLE:
if method in ["banded", "all"]: if method in ["banded", "all"]:
SLE.print_tridiagonal() SLE.print_tridiagonal()
class Approx: class Approx:
function = "np.sin(x) * np.sqrt(np.abs(x))" function_exp = "np.sin(x) * np.sqrt(np.abs(x))"
least_sq_exp = "np.sin(x) * np.abs(x)"
@staticmethod
def get_function_exp_der(*args):
function_der_exp = "(x * np.sin(x) + 2 * x**2 * np.cos(x)) / (2 * np.sqrt(np.abs(x)) ** 3)"
result = ()
for i in args:
array = []
for x in i:
array.append(eval(function_der_exp))
result = result + (array,)
return result
@staticmethod
def generate_y(x_array, function):
result = []
for x in x_array:
result.append(eval(function))
return result
@staticmethod
def lagrange(x, y):
return sitp.lagrange(x, y)
@staticmethod
def get_approx_data(function=function_exp, bounds=[-6, 6]):
x1 = generate_array(bounds[0], bounds[1], 1/2)
x2 = generate_array(bounds[0], bounds[1], 1)
y1 = Approx.generate_y(x1, function)
y2 = Approx.generate_y(x2, function)
x_real = generate_array(bounds[0], bounds[1])
y_real = Approx.generate_y(x_real, function)
return x1, x2, y1, y2, x_real, y_real
@staticmethod
def plot_lagrange():
x1, x2, y1, y2, x_real, y_real = Approx.get_approx_data()
sp = create_subplot()
sol1 = np.polynomial.polynomial.Polynomial(
Approx.lagrange(x1, y1).coef[::-1])
sol2 = np.polynomial.polynomial.Polynomial(
Approx.lagrange(x2, y2).coef[::-1])
plt_append(
sp, x_real, y_real, f"Исходные данные (y={Approx.function_exp})", "--b")
plt_append(
sp, x_real, sol1(np.array(x_real)), f"f1 = lagrange, кол-во точек = {len(x1)}", "-m")
plt_append(
sp, x_real, sol2(np.array(x_real)), f"f2 = lagrange, кол-во точек = {len(x2)}", "-r")
plt_append(
sp, x1, y1, f"Исходные точки для f1", ".m")
plt_append(
sp, x2, y2, f"Исходные точки для f2", ".r")
sp.set_title("scipy.interpolate.lagrange")
sp.legend(loc='lower left')
@staticmethod
def plot_spline():
x1, x2, y1, y2, x_real, y_real = Approx.get_approx_data()
d1, d2 = Approx.get_function_exp_der(x1, x2)
for interpolator in [sitp.CubicSpline,
sitp.PchipInterpolator,
sitp.CubicHermiteSpline,
sitp.Akima1DInterpolator]:
sp = create_subplot()
if interpolator.__name__ != "CubicHermiteSpline":
args1 = x1, y1
args2 = x2, y2
else:
args1 = x1, y1, d1
args2 = x2, y2, d2
sol1 = interpolator(*args1)
sol2 = interpolator(*args2)
plt_append(
sp, x_real, y_real, f"Исходные данные (y={Approx.function_exp})", "--b")
plt_append(
sp, x_real, sol1(np.array(x_real)), f"f1 = {interpolator.__name__}, кол-во точек = {len(x1)}", "-m")
plt_append(
sp, x_real, sol2(np.array(x_real)), f"f2 = {interpolator.__name__}, кол-во точек = {len(x2)}", "-r")
plt_append(
sp, x1, y1, f"Исходные точки для f1", ".m")
plt_append(
sp, x2, y2, f"Исходные точки для f2", ".r")
sp.set_title(f"scipy.interpolate.{interpolator.__name__}")
sp.legend(loc='lower left')
@staticmethod
def linear(x, a, b):
return a*x + b
@staticmethod
def quadratic(x, a, b, c):
return a * (x**2) + (b*x) + c
@staticmethod
def fract(x, a, b, c):
return x / (a * x + b) - c
@staticmethod
def noise_y(y, rng):
diff = max(y) - min(y)
noise_coeff = diff*(10/100)
return y + (noise_coeff * rng.normal(size=len(y)))
@staticmethod
def plot_least_squares_curvefit():
rng = np.random.default_rng()
bounds = [3, 6]
x1, x2, y1, y2, x_real, y_real = Approx.get_approx_data(
Approx.least_sq_exp, bounds)
x_real = np.array(x_real)
y_real = Approx.noise_y(y_real, rng)
base_functions = [Approx.linear,
Approx.quadratic, (Approx.fract, "x/(ax+b)")]
sp = create_subplot()
plt_append(
sp, x_real, y_real, f"y={Approx.least_sq_exp} на [{bounds[0]};{bounds[1]}], с шумом", ".b")
for bf in base_functions:
if isinstance(bf, tuple):
bf, desc = bf[0], bf[1]
else:
bf, desc = bf, None
optimal_params, _ = sopt.curve_fit(bf, x_real, y_real)
desc_str = f" ({desc}) " if desc is not None else ""
plt_append(
sp, x_real, bf(np.array(x_real), *optimal_params),
f"МНК, вид функции - {bf.__name__}{desc_str}", "-")
sp.set_title(f"scipy.optimize.curve_fit")
sp.legend(loc='lower left')
@staticmethod
def plot_least_squares():
rng = np.random.default_rng()
def exponential(x, a, b, c):
return np.sin(x) * np.sqrt(np.abs(x))
exponential.str = "np.sin(x) * np.sqrt(np.abs(x))"
def gen_y(x, a, b, c, noise=0., n_outliers=0):
y = exponential(x, a, b, c)
error = noise * rng.standard_normal(x.size)
outliers = rng.integers(0, x.size, n_outliers)
error[outliers] *= 10
return y + error
def loss(params, x, y):
return (exponential(x, params[0], params[1], params[2])) - y
params0 = np.array([0.1, 1, 0])
bounds = [-5, 3]
params_real = (3, 1, 5)
x_approx = np.array(generate_array(bounds[0], bounds[1], 4))
y_approx = np.array(gen_y(x_approx, *params_real,
noise=0.3, n_outliers=4))
params_lsq = sopt.least_squares(
loss, params0, loss='linear', args=(x_approx, y_approx)).x
params_soft_l1 = sopt.least_squares(
loss, params0, loss='soft_l1', args=(x_approx, y_approx),f_scale=0.1).x
params_cauchy = sopt.least_squares(
loss, params0, loss='cauchy', args=(x_approx, y_approx), f_scale=2).x
x_real = np.array(generate_array(bounds[0], bounds[1]))
y_real = np.array(gen_y(x_real, *params_real, 0, 0))
sp = create_subplot()
sp.plot(x_real, y_real, "-b",
label=f"y={exponential.str} на [{bounds[0]};{bounds[1]}]")
sp.plot(x_approx, y_approx, ".r", label=f"Табличные значения с шумом")
sp.plot(x_real, gen_y(x_real, *params_lsq), color="green",
label=f"loss=\"linear\"", linestyle=(0, (5, 10)))
sp.plot(x_real, gen_y(x_real, *params_soft_l1), color="magenta",
label=f"loss=\"soft_l1\"", linestyle=(5, (5, 10)))
sp.plot(x_real, gen_y(x_real, *params_cauchy), color="black",
label=f"loss=\"cauchy\"", linestyle=(7, (5, 10)))
sp.set_title(f"scipy.optimize.least_squares")
sp.legend(loc='lower left')
@staticmethod
def plot(method: str = "all"):
if method in ["lagrange", "all"]:
Approx.plot_lagrange()
if method in ["spline", "all"]:
Approx.plot_spline()
if method in ["least_squares_curvefit", "all"]:
Approx.plot_least_squares_curvefit()
if method in ["least_squares", "all"]:
Approx.plot_least_squares()
plt.ylabel("y")
plt.xlabel("x")
plt.show()
def main(): def main():
# NonLinear.plot() NonLinear.plot()
SLE.print() SLE.print()
Approx.plot()
if __name__ == "__main__": if __name__ == "__main__":
+15
View File
@@ -0,0 +1,15 @@
\chapter*{Заключение}
В ходе выполнения работы были выполнены поставленные задачи, цель
достигнута. В ходе исследования возможностей библиотек выяснилось,
что они не содержат реализаций численных методов для
решения систем нелинейных уравнений.
В целом, в ходе работы с библиотеками стоит отметить положительные
стороны: гибкость интерфейсов, высокое качество решений, большое
количество доступной информации о результатах работы алгоритма.
Из недостатков интерфейса библиотек можно отметить его неоднородность ---
некоторые численные методы реализованы с помощью классов, другие
с помощью функций, что может незначительно увеличить время на
освоение интерфейса библиотек и ее возможностей пользователями.
+68
View File
@@ -5,6 +5,7 @@
\usepackage{threeparttable} \usepackage{threeparttable}
\usepackage[labelsep=endash,tableposition=top,labelfont=md,textfont=md]{caption} \usepackage[labelsep=endash,tableposition=top,labelfont=md,textfont=md]{caption}
\usepackage{indentfirst} \usepackage{indentfirst}
\usepackage{float}
\usepackage{rotating} \usepackage{rotating}
\usepackage{setspace} \usepackage{setspace}
\usepackage{array} \usepackage{array}
@@ -111,6 +112,73 @@
tabsize=3, tabsize=3,
escapechar={|}, escapechar={|},
emptylines=0, emptylines=0,
extendedchars=true,
literate={а}{{\cyra}}1
{б}{{\cyrb}}1
{в}{{\cyrv}}1
{г}{{\cyrg}}1
{д}{{\cyrd}}1
{е}{{\cyre}}1
{ё}{\"{\cyre}}1
{ж}{{\cyrzh}}1
{з}{{\cyrz}}1
{и}{{\cyri}}1
{й}{{\cyrishrt}}1
{к}{{\cyrk}}1
{л}{{\cyrl}}1
{м}{{\cyrm}}1
{н}{{\cyrn}}1
{о}{{\cyro}}1
{п}{{\cyrp}}1
{р}{{\cyrr}}1
{с}{{\cyrs}}1
{т}{{\cyrt}}1
{у}{{\cyru}}1
{ф}{{\cyrf}}1
{х}{{\cyrh}}1
{ц}{{\cyrc}}1
{ч}{{\cyrch}}1
{ш}{{\cyrsh}}1
{щ}{{\cyrshch}}1
{ъ}{{\cyrhrdsn}}1
{ы}{{\cyrery}}1
{ь}{{\cyrsftsn}}1
{э}{{\cyrerev}}1
{ю}{{\cyryu}}1
{я}{{\cyrya}}1
{А}{{\CYRA}}1
{Б}{{\CYRB}}1
{В}{{\CYRV}}1
{Г}{{\CYRG}}1
{Д}{{\CYR96}}1
{Е}{{\CYRE}}1
{Ё}{{\"{\CYRE}}}1
{Ж}{{\CYRZH}}1
{З}{{\CYRZ}}1
{И}{{\CYRI}}1
{Й}{{\CYRISHRT}}1
{К}{{\CYRK}}1
{Л}{{\CYRL}}1
{М}{{\CYRM}}1
{Н}{{\CYRN}}1
{О}{{\CYRO}}1
{П}{{\CYRP}}1
{Р}{{\CYRR}}1
{С}{{\CYRS}}1
{Т}{{\CYRT}}1
{У}{{\CYRU}}1
{Ф}{{\CYRF}}1
{Х}{{\CYRH}}1
{Ц}{{\CYRC}}1
{Ч}{{\CYRCH}}1
{Ш}{{\CYRSH}}1
{Щ}{{\CYRSHCH}}1
{Ъ}{{\CYRHRDSN}}1
{Ы}{{\CYRERY}}1
{Ь}{{\CYRSFTSN}}1
{Э}{{\CYREREV}}1
{Ю}{{\CYRYU}}1
{Я}{{\CYRYA}}1
} }
\newcommand\inputcode[3][]{ \newcommand\inputcode[3][]{
{\bfseries #1\filename{#2}}: {\bfseries #1\filename{#2}}:
+64
View File
@@ -0,0 +1,64 @@
\chapter{Экспериментальное исследование возможностей библиотек}
Для исследования возможностей библиотек была разработана программа
на языке Python. Она позволяет изучить работу наиболее популярных
численных методов: методов решения нелинейных уравнений и
СЛУ, а также аппроксимации функций.
Ее структура состоит из классов \textbf{NonLinear}, \textbf{SLE},
\textbf{Approx}. Они состоят только из статических методов,
пользовательских родительских классов не имеют.
При запуске программа сначала выводит графики решений нелинейных
уравнений в отдельных окнах (рисунок \ref{bisect}, рисунок\ref{newton}),
входные и выходные данные для методов решения СЛУ в терминале, и
затем результаты аппроксимации, так же в виде графиков в отдельных
окнах.
Результат работы метода Гаусса (вывод терминала) приведен на
рисунке \ref{gauss}.
Вывод графиков осуществляется с помощью библиотеки \textbf{matplotlib},
через функции \textbf{matplotlib.pyplot.plot} и \textbf{matplotlib.pyplot.subplots} \cite{links:matplotlib}.
Все графики имеют заголовок, в котором написано название функции,
легенду в нижнем левом углу, в которой описаны данные графика.
\begin{figure}[ht]
\centering
\includegraphics[width=0.6\textwidth]{assets/bisect.png}
\caption{Результат исследования функции bisect}
\label{bisect}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=0.6\textwidth]{assets/newton.png}
\caption{Результат исследования функции newton}
\label{newton}
\end{figure}
\begin{figure}[ht]
\centering
\includegraphics[width=0.6\textwidth]{assets/Gauss.png}
\caption{Результат решения СЛУ методом Гаусса}
\label{gauss}
\end{figure}
Для получения результатов исследования отдельных классов численных
методов есть следующие методы:
\begin{enumerate}
\item \textbf{NonLinear.plot} для вывода графиков результатов
решения нелинейных уравнений, \textbf{Approx.plot} --- для вывода
графиков решения задачи аппроксимации.
\item \textbf{SLE.print} --- для вывода результатов решения
СЛУ в терминал
\end{enumerate}
Данные методы самостоятельно вызываются при запуске программы
пользователем.
Вывод терминала а также графики для остальных методов приведены
в приложении А.
Код программы приведен в приложении Б.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

+44 -29
View File
@@ -556,41 +556,57 @@ LU-разложение \cite[с. 259]{book:levitin}. Для получения
Обе функции принимают матрицу \(ab\) либо в верхней (\textbf{solve\_banded}), либо в нижней форме (\textbf{solveh\_banded} при Обе функции принимают матрицу \(ab\) либо в верхней (\textbf{solve\_banded}), либо в нижней форме (\textbf{solveh\_banded} при
включенной опции \(lower\)). Например, для матрицы включенной опции \(lower\)). Например, для матрицы
\begin{tabular}[htpb]{ccccc} \begin{equation*}
5 & 2 & -1 & 0 & 0 \\ \left(
1 & 4 & 2 & -1 & 0 \\ \begin{aligned}
0 & 1 & 3 & 2 & -1 \\ 5 && 2 && -1 && 0 && 0 \\
0 & 0 & 1 & 2 & 2 \\ 1 && 4 && 2 && -1 && 0 \\
0 & 0 & 0 & 1 & 1 \\ 0 && 1 && 3 && 2 && -1 \\
\end{tabular}\\ 0 && 0 && 1 && 2 && 2 \\
0 && 0 && 0 && 1 && 1
\end{aligned}
\right)
\end{equation*}
верхняя форма будет следующей: верхняя форма будет следующей:
\begin{tabular}[htpb]{ccccc} \begin{equation*}
0 & 0 & -1 & -1 & -1 \\ \left(
0 & 2 & 2 & 2 & 2 \\ \begin{aligned}
5 & 4 & 3 & 2 & 1 \\ 0 && 0 && -1 && -1 && -1 \\
1 & 1 & 1 & 1 & 0 \\ 0 && 2 && 2 && 2 && 2 \\
\end{tabular} 5 && 4 && 3 && 2 && 1 \\
1 && 1 && 1 && 1 && 0
\end{aligned}
\right)
\end{equation*}
Так как данная матрица не эрмитова, и, следовательно, не положительно Так как данная матрица не эрмитова, и, следовательно, не положительно
определенна, нижняя форма для нее не существует. Если взять эрмитову определенна, нижняя форма для нее не существует. Если взять эрмитову
положительно определенную матрицу положительно определенную матрицу
\begin{tabular}[htpb]{cccccc} \begin{equation*}
4 & 2 & -1 & 0 & 0 & 0 \\ \left(
2 & 5 & 2 & -1 & 0 & 0 \\ \begin{aligned}
-1 & 2 & 6 & 2 & -1 & 0 \\ 4 && 2 && -1 && 0 && 0 && 0 \\
0 & -1 & 2 & 7 & 2 & -1 \\ 2 && 5 && 2 && -1 && 0 && 0 \\
0 & 0 & -1 & 2 & 8 & 2 \\ -1 && 2 && 6 && 2 && -1 && 0 \\
0 & 0 & 0 & -1 & 2 & 9 \\ 0 && -1 && 2 && 7 && 2 && -1 \\
\end{tabular}\\ 0 && 0 && -1 && 2 && 8 && 2 \\
0 && 0 && 0 && -1 && 2 && 9
\end{aligned}
\right)
\end{equation*}
то ее нижняя форма будет следующая: то ее нижняя форма будет следующая:
\begin{tabular}[htpb]{cccccc} \begin{equation*}
4 & 5 & 6 & 7 & 8 & 9 \\ \left(
2 & 2 & 2 & 2 & 2 & 0 \\ \begin{aligned}
-1 & -1 & -1 & -1 & 0 & 0 \\ 4 && 5 && 6 && 7 && 8 && 9 \\
\end{tabular} 2 && 2 && 2 && 2 && 2 && 0 \\
-1 && -1 && -1 && -1 && 0 && 0
\end{aligned}
\right)
\end{equation*}
\subsection{Метод простой итерации (метод Якоби)} \subsection{Метод простой итерации (метод Якоби)}
\subsubsection{Описание метода} \subsubsection{Описание метода}
@@ -1904,9 +1920,8 @@ f\(x\), если \(f^{(4)}(x) = 0, x \in [a;b] \), в соответствии
считается плотной. считается плотной.
\end{itemize} \end{itemize}
\end{enumerate} \end{enumerate}
\chapter{Экспериментальное исследование возможностей библиотек} \input{experimental_research}
\input{conclusion}
\chapter*{Заключение}
\addcontentsline{toc}{chapter}{Заключение} \addcontentsline{toc}{chapter}{Заключение}
\input{sources} \input{sources}
+122 -17
View File
@@ -1,6 +1,4 @@
\documentclass{beamer} \documentclass{beamer}
\usepackage[russian]{babel} \usepackage[russian]{babel}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage[outputdir=cache]{minted} \usepackage[outputdir=cache]{minted}
@@ -14,7 +12,7 @@
\title[]{\cwtitle} \title[]{\cwtitle}
\institute[]{ФГБОУ ВО «Вятский государственный университет»} \institute[]{ФГБОУ ВО «Вятский государственный университет»}
\date{\null} \date{\null}
\author[ ]{Студент ПМИб-3301-52-00 \cwauthor\\ \and к.п.н. А.Н.~Соколова} \author[ ]{Студент ПМИб-3301-52-00 \cwauthor \newline \and к.п.н. А.Н.~Соколова}
\newcommand\frametitleSpec[1]{% \newcommand\frametitleSpec[1]{%
\frametitle{#1} \frametitle{#1}
@@ -27,43 +25,150 @@
\begin{document} \begin{document}
\begin{frame} \begin{frame}
\centering\includegraphics[width=0.4\textwidth]{files/vyatsu_logo.png}\\ \centering\includegraphics[width=0.4\textwidth]{assets/vyatsu_logo.png}\\
\titlepage \titlepage
\end{frame} \end{frame}
\begin{frame} \begin{frame}
\frametitle{План доклада} \frametitle{План доклада}
\tableofcontents \tableofcontents
\end{frame} \end{frame}
\begin{frame} \begin{frame}
\frametitleSpec{Введение} \frametitleSpec{Введение}
Активное внедрение компьютеров во всевозможные отрасли жизни человека привело к тому, что при решении прикладных задач требование к скорости и дешевизне разработки стало выше требований производительности и ресурсоемкости разрабатываемой программы. Для языка Python разработаны библиотеки numpy и scipy
математической направленности.
Они включают в себя множество алгоритмов решения разнообразных задач, в том числе для интегрирования функций, осуществления операций над массивами и
матрицами.
\begin{enumerate} \begin{enumerate}
\item Проблема состоит в том, что на данный момент ОС, которая бы могла более эффективно использовать текущее АО устройств, не разработана. \item Проблема состоит в том, что на данный момент особенности
\item Целью данной работы является рассмотрение архитектуры и разработка части прототипа данной ОС. библиотек, полнота их возможностей с точки зрения решения
задач численными методами недостаточно исследованы.
\item \textbf{Целью} данной работы является исследование
вышеприведенных характеристик данных библиотек.
\item Для достижения цели курсового проекта необходимо выполнить
следующие \textbf{задачи}:
\begin{itemize} \begin{itemize}
\item Изучить архитектуру и требования прототипа ОС. \item Изучить распространенные численные методы решения
\item Определить перечень сервисов обеспечения целостности и оптимизации экосистемы устройств. основных классов задач.
\item Разработать БД и сервисы обеспечения целостности и оптимизации прототипа экосистемы устройств. \item Изучить документацию библиотек numpy и scipy на
предмет реализации рассмотренных методов.
\item Экспериментально исследовать возможности
реализаций рассмотренных численных методов данных
библиотек.
\end{itemize} \end{itemize}
\end{enumerate} \end{enumerate}
\end{frame} \end{frame}
\begin{frame} \begin{frame}
\frametitleSpec{О программной реализации} \frametitleSpec{Рассмотренные численные методы}
Реализация сервисов написана на языке C++ в виде отдельных компонентов.
Всего было рассмотрено 20 численных методов, каждый из которых
решает свой класс задач:
\begin{enumerate}
\item Решение нелинейных уравнений
\begin{itemize}
\item Метод деления отрезка пополам
\item Метод касательных (Ньютона)
\item Метод простой итерации
\end{itemize}
\item Решение СЛУ:
\begin{itemize}
\item Метод Гаусса
\item Метод обратной матрицы
\item Метод прогонки
\item Метод простой итерации
\item Метод Зейделя
\end{itemize}
\item Решение систем нелинейных уравнений, с помощью метода Ньютона, и модифицированных версий методов Зейделя и простой итерации.
\end{enumerate}
\end{frame}
\begin{frame}
\begin{enumerate}
\item Аппроксимация функций
\begin{itemize}
\item Интерполяционные полиномы Лагранжа, Ньютона
\item Сплайн-интерполяция
\item Сглаживание. Метод наименьших квадратов
\end{itemize}
\item Численное интегрирование
\begin{itemize}
\item Метод трапеций
\item Метод парабол
\end{itemize}
\item Решение задачи Коши ОДУ
\begin{itemize}
\item Метод Эйлера, и его модифицированная версия
\item Метод Рунге-Кутта
\end{itemize}
\end{enumerate}
\end{frame}
\begin{frame}
\frametitleSpec{Экспериментальное исследование библиотек}
Была разработана программа на языке Python, использующая
возможности scipy и numpy для решения задач.
\begin{figure}[h] \begin{figure}[h]
\centering \centering
\includegraphics[width=0.25\textwidth]{files/cpp-logo.png} \includegraphics[width=0.25\textwidth]{assets/python-logo.png}
\end{figure} \end{figure}
В программе были приведены примеры решения СЛУ, нелинейных уравнений
и задач аппроксимации функций с помощью описанных в данной работе
методов. Программа не интерактивная.
\end{frame} \end{frame}
\begin{frame}
\frametitleSpec{Результаты работы программы}
\begin{figure}
\includegraphics[width=0.5\textwidth]{assets/bisect}
\end{figure}
\begin{figure}
\includegraphics[width=0.65\textwidth]{assets/Gauss}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\includegraphics[width=1\textwidth]{assets/Thomas.png}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\includegraphics[width=1\textwidth]{assets/lagrange.png}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\includegraphics[width=1\textwidth]{assets/CubicSpline}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\includegraphics[width=1\textwidth]{assets/Akima1DInterpolator.png}
\end{figure}
\end{frame}
\begin{frame}
\begin{figure}
\includegraphics[width=1\textwidth]{assets/curve_fit.png}
\end{figure}
\end{frame}
\begin{frame} \begin{frame}
\frametitleSpec{Заключение} \frametitleSpec{Заключение}
При реализации прототипа экосистемы был разработан один из возможных вариантов деления на подсистемы, и рассмотрены возможные пути реализации. В ходе выполнения работы были выполнены поставленные задачи, цель
Из недостатков текущей реализации можно отметить отсутствие компонента, отвечающего за безопасность и разделения прав доступа пользователей к вычислительным ресурсам сервера. достигнута. В ходе исследования возможностей библиотек выяснилось,
Таким образом, задачи проекта выполнены, цель проекта достигнута. что они не содержат реализаций численных методов для
решения систем нелинейных уравнений.
В целом, в ходе работы с библиотеками стоит отметить положительные
стороны: гибкость интерфейсов, высокое качество решений, большое
количество доступной информации о результатах работы алгоритма.
Из недостатков интерфейса библиотек можно отметить его
неоднородность --- некоторые численные методы реализованы с помощью
классов, другие с помощью функций, что может незначительно
увеличить время на освоение интерфейса библиотек и ее возможностей
пользователями.
\end{frame} \end{frame}
\begin{frame} \begin{frame}
\begin{center} \begin{center}
+7 -10
View File
@@ -4,28 +4,25 @@
\or 07.08.2023% 2 \or 07.08.2023% 2
\or 09.08.2023% 3 \or 09.08.2023% 3
\or 19.08.2023% 4 \or 19.08.2023% 4
\or 17.10.2023% 5
\else\@ctrerr\fi \else\@ctrerr\fi
} }
\renewcommand\bibname{Библиографический список} \renewcommand\bibname{Библиографический список}
\begin{thebibliography}{00} \begin{thebibliography}{00}
\addcontentsline{toc}{chapter}{Библиографический список} \addcontentsline{toc}{chapter}{Библиографический список}
\bibitem{book:nm-examples} Ахмадиев Ф.Г., Габбасов Ф.Г., Ермолаева Л.Б., Маланичев И.В. Численные методы. Примеры и задачи. Учебно-методическое пособие по курсам «Информатика» и «Вычислительная математика». -- Казань: \bibitem{book:nm-examples} Ахмадиев Ф.Г., Габбасов Ф.Г., Ермолаева Л.Б., Маланичев И.В. Численные методы. Примеры и задачи. Учебно-методическое пособие по курсам «Информатика» и «Вычислительная математика». -- Казань: КГАСУ, 2017. -- 107 с.
КГАСУ, 2017. -- 107 с. \bibitem{book:bahvalov} Бахвалов~Н.~С., Жидков~Н.~П., Кобельков~Г.~М. Численные методы. -- 7-е изд. -- М.: БИНОМ. Лаборатория знаний, 2011. -- 636 с., c илл. -- (Классический университетский учебник).
\bibitem{book:bahvalov} Бахвалов~Н.~С., Жидков~Н.~П., \bibitem{links:matplotlib} Документация модуля pyplot библиотеки matplotlib [Электронный ресурс] -- URL:~\url{https://matplotlib.org/stable/api/pyplot_summary.html} (\LiteratureAccessDate[5]).
Кобельков~Г.~М. Численные методы. -- 7-е изд. -- М.: БИНОМ. Лаборатория знаний,
2011. -- 636 с., c илл. -- (Классический университетский учебник).
\bibitem{book:levitin} Левитин~A.~В. Алгоритмы: введение в разработку и анализ. -- Пер.~с~англ. -- М.:Издательский~дом~"Вильяме", 2006. -- 576 с., с ил. \bibitem{book:levitin} Левитин~A.~В. Алгоритмы: введение в разработку и анализ. -- Пер.~с~англ. -- М.:Издательский~дом~"Вильяме", 2006. -- 576 с., с ил.
\bibitem{book:lectures} Письменный~Д.~Т. Конспект лекций по высшей математике. 2 часть. -- М.: Рольф, 2000. -- 256 с., с илл. \bibitem{book:lectures} Письменный~Д.~Т. Конспект лекций по высшей математике. 2 часть. -- М.: Рольф, 2000. -- 256 с., с илл.
\bibitem{article:fehlberg} Classical Fifth-, Sixth-, Seventh-, and Eighth-Order Runge-Kutta Formulas with Stepsize Control / Fehlberg E. // NASA technical report 287 -- 1968. -- P.~82
\bibitem{links:numpy} Numpy. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://numpy.org/} (\LiteratureAccessDate[2]). \bibitem{links:numpy} Numpy. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://numpy.org/} (\LiteratureAccessDate[2]).
\bibitem{links:numpy_doc} Numpy API Reference [Электронный ресурс] -- URL:~\url{https://numpy.org/doc/stable/reference/index.html} (\LiteratureAccessDate[3]). \bibitem{links:numpy_doc} Numpy API Reference [Электронный ресурс] -- URL:~\url{https://numpy.org/doc/stable/reference/index.html} (\LiteratureAccessDate[3]).
\bibitem{links:PEP465} PEP 465 -- A dedicated infix operator for matrix multiplication [Электронный ресурс] -- URL:~\url{A dedicated infix operator for matrix multiplication} (\LiteratureAccessDate[4]). \bibitem{links:PEP465} PEP 465 -- A dedicated infix operator for matrix multiplication [Электронный ресурс] -- URL:~\url{A dedicated infix operator for matrix multiplication} (\LiteratureAccessDate[4]).
\bibitem{links:python} Python. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://www.python.org/} (\LiteratureAccessDate).
\bibitem{links:bhatia} Positive definite matrices / R. Bhatia // Princeton Series in Applied Mathematics -- 2007. \bibitem{links:bhatia} Positive definite matrices / R. Bhatia // Princeton Series in Applied Mathematics -- 2007.
\bibitem{links:python} Python. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://www.python.org/} (\LiteratureAccessDate).
\bibitem{links:scipy} Scipy. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://scipy.org/} (\LiteratureAccessDate[2]). \bibitem{links:scipy} Scipy. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://scipy.org/} (\LiteratureAccessDate[2]).
\bibitem{links:scipy_doc} Scipy API Reference [Электронный ресурс] -- URL:~\url{https://docs.scipy.org/doc/scipy/reference/index.html} (\LiteratureAccessDate[3]). \bibitem{links:scipy_doc} Scipy API Reference [Электронный ресурс] -- URL:~\url{https://docs.scipy.org/doc/scipy/reference/index.html} (\LiteratureAccessDate[3]).
\bibitem{links:tiobe_index} TIOBE. Официальный сайт проекта
[Электронный ресурс] -- URL:~\url{https://www.tiobe.com/tiobe-index/} (\LiteratureAccessDate).
\bibitem{journal:cartwright} Simpson's Rule Cumulative Integration with MS Excel and Irregularly-spaced Data / Cartwright, Kenneth V. // Journal of Mathematical Sciences and Mathematics Education. -- 2017. -- Vol.~12~(2) -- P.~1-9. \bibitem{journal:cartwright} Simpson's Rule Cumulative Integration with MS Excel and Irregularly-spaced Data / Cartwright, Kenneth V. // Journal of Mathematical Sciences and Mathematics Education. -- 2017. -- Vol.~12~(2) -- P.~1-9.
\bibitem{article:fehlberg} Classical Fifth-, Sixth-, Seventh-, and Eighth-Order Runge-Kutta Formulas with Stepsize Control / Fehlberg E. // NASA technical report 287 -- 1968. \bibitem{links:tiobe_index} TIOBE. Официальный сайт проекта [Электронный ресурс] -- URL:~\url{https://www.tiobe.com/tiobe-index/} (\LiteratureAccessDate).
-- P.~82
\end{thebibliography} \end{thebibliography}