{"id":349950,"date":"2023-07-07T21:00:38","date_gmt":"2023-07-07T21:00:38","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=349950"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=349950","title":{"rendered":"<span>\u041b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0430\u043b\u0433\u0435\u0431\u0440\u0430 \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0444\u0438\u0448\u0435\u043a \u0438\u0437 Python (\u0447\u0430\u0441\u0442\u044c 1)<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a\u0430\u043a \u0435\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0432 Python \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043d\u0438\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/891\/eb6\/680\/891eb66804d3f9adc7e3157a2fd2f57f.png\" width=\"907\" height=\"302\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/891\/eb6\/680\/891eb66804d3f9adc7e3157a2fd2f57f.png\"\/><\/figure>\n<p>\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/bdd\/66d\/0d3\/bdd66d0d3ad5d3d828446dd4bf9bfd2f.png\" width=\"526\" height=\"320\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bdd\/66d\/0d3\/bdd66d0d3ad5d3d828446dd4bf9bfd2f.png\"\/><\/figure>\n<p>\u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 \u0438\u0437 m \u0441\u0442\u0440\u043e\u043a \u0438 n \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432.<\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c:<\/p>\n<p>1) \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439.<\/p>\n<p>2) \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u043e \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439.<\/p>\n<p>3) \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0438 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0434\u043d\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/579\/6f1\/485\/5796f14850ead103f4ab86ced8123ef0.png\" width=\"915\" height=\"315\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/579\/6f1\/485\/5796f14850ead103f4ab86ced8123ef0.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/097\/654\/2de\/0976542de93f49a0f4433cd867f8c2df.png\" width=\"907\" height=\"384\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/097\/654\/2de\/0976542de93f49a0f4433cd867f8c2df.png\"\/><\/figure>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0430 Python<\/h3>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Jupyter Notebook, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0441\u043a\u0430\u0447\u0430\u0432 <a href=\"https:\/\/www.anaconda.com\/download\" rel=\"noopener noreferrer nofollow\">Anaconda<\/a>. Jupyter \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432: 1) \u041c\u043d\u043e\u0433\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b, 2) \u0411\u043b\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434, \u0442.\u0435. \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c, 3) \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f Jyputer, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Google Colab.<\/p>\n<p>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0432 Python \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f 2 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438: Sympy \u0438 Nympy. <\/p>\n<p><strong>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f Sympy:<\/strong><\/p>\n<p>\u0414\u0430\u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f0f\/260\/f2b\/f0f260f2bbfe34ea7596c0b36a3f8313.png\" width=\"652\" height=\"308\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f0f\/260\/f2b\/f0f260f2bbfe34ea7596c0b36a3f8313.png\"\/><\/figure>\n<pre><code class=\"python\">from sympy import * \u0410 = Matrix([[-3, 9, 2,4,0], [1,4,-1,3,-1], [0,2,-2,4,2], [3,1,0,-2,3]])<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c shape() (\u0442.\u0435. \u0443\u0437\u043d\u0430\u0435\u043c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0432 \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435)<\/p>\n<pre><code class=\"python\">shape(A)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0438\u043b\u0438 \u0441\u0442\u043e\u043b\u0431\u0435\u0446(\u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 Python):<\/p>\n<pre><code class=\"python\">A.row(0) A.col(-1)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u043b\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434 row_del() \u0438 col_del()<\/p>\n<pre><code class=\"python\">A.col_del(0) A.row_del(1)<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443<\/p>\n<pre><code class=\"python\">M = Matrix([[1, 2], [-2, 0]]) M = M.row_insert(1, Matrix([[0, 4]])) M = M.col_insert(0, Matrix([1, -2, 3]))<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 Sympy \u0435\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<p>1) \u041d\u0443\u043b\u0435\u0432\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430<\/p>\n<pre><code class=\"python\">zeros(3,2)<\/code><\/pre>\n<p>2) \u041c\u0430\u0442\u0440\u0438\u0446\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446<\/p>\n<pre><code class=\"python\">ones(3,2)<\/code><\/pre>\n<p>3) \u0415\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430(\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u044b, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0443\u043b\u0438)<\/p>\n<pre><code class=\"python\">eye(4)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043f\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438:<\/p>\n<pre><code class=\"python\">diag(1,2,3)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u0440\u0435\u0431\u044f\u0442 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0435 \u0448\u0442\u0443\u043a\u0438<\/p>\n<pre><code class=\"python\">diag(-1, ones(2,2), Matrix([5,7,5]))l<\/code><\/pre>\n<p><strong>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 Numpy<\/strong><\/p>\n<pre><code class=\"python\">import numpy as np<\/code><\/pre>\n<pre><code class=\"python\">C = np.array([[1,2,3], [4,5,6], [7,8,9]]) M = np.matrix([[1,2,3], [4,5,6], [7,8, 9]])<\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 <\/p>\n<pre><code class=\"python\">H = np.matrix('1,2,3;4,5,6;7,8,9')<\/code><\/pre>\n<p>\u0412 Numpy \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435<\/p>\n<p>1) \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0438\u0437 \u043d\u0443\u043b\u0435\u0439<\/p>\n<pre><code class=\"python\">np.zeros((2,3))<\/code><\/pre>\n<p>2) \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446<\/p>\n<pre><code class=\"python\">np.ones((2,3))<\/code><\/pre>\n<p>3) \u0415\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430<\/p>\n<pre><code class=\"python\">np.eye(3)<\/code><\/pre>\n<p>\u0418 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0447\u0435\u0440\u0435\u0437 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c<\/p>\n<pre><code class=\"python\">np.diag([1,2,3])<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438(\u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435)<\/p>\n<p><strong>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 &#8212; \u0442.\u0435. \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043a\u043e\u043b-\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0438 \u0441\u0442\u0440\u043e\u0447\u0435\u043a<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5df\/a93\/330\/5dfa933302261d003660ae27007223f2.png\" width=\"1359\" height=\"760\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5df\/a93\/330\/5dfa933302261d003660ae27007223f2.png\"\/><\/figure>\n<p>\u041d\u0430 Sympy:<\/p>\n<pre><code>A = Matrix([[1,2,3], [4,5,6], [7,8,9]]) B = Matrix([[1,2,3], [4,5,6], [7,8,9]]) print(A+B)<\/code><\/pre>\n<p>\u041d\u0430 Numpy:<\/p>\n<pre><code>A = np.array([[1,2,3], [4,5,6], [7,8,9]]) B = np.array([[1,2,3], [4,5,6], [7,8,9]]) print(A+B)<\/code><\/pre>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446<\/p>\n<p>1) A+B=B+A(\u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c)<\/p>\n<p>2) A+(B+C) = (A+B)+C(\u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c)<\/p>\n<p>3) \u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u0430\u044f \u0435\u0439 (-A), \u0442\u0430\u043a\u0430\u044f \u0447\u0442\u043e \u0438\u0445 \u0441\u0443\u043c\u043c\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439<\/p>\n<p>\u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Python \u043f\u043e \u0442\u0435\u043c \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c.<\/p>\n<p>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u044b\u043c \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0434\u043e\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0447\u0438\u0441\u043b\u043e  <\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f31\/c08\/770\/f31c0877021568b82338e2b185925d53.png\" width=\"374\" height=\"255\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f31\/c08\/770\/f31c0877021568b82338e2b185925d53.png\"\/><\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A \u0440\u0430\u0432\u043d\u043e \u0447\u0438\u0441\u043b\u0443 \u0441\u0442\u0440\u043e\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u044b B. \u0415\u0441\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 A \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 (m*n), \u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 B \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440(k*n), \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 (m*n).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2b6\/bad\/c09\/2b6badc09fb801d3184b56ab08f83ff4.png\" width=\"667\" height=\"384\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2b6\/bad\/c09\/2b6badc09fb801d3184b56ab08f83ff4.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8c2\/a6b\/822\/8c2a6b8228a91e688130805686cf4edf.png\" width=\"479\" height=\"244\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8c2\/a6b\/822\/8c2a6b8228a91e688130805686cf4edf.png\"\/><\/figure>\n<p>\u0412 Sympy \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"python\">A = Matrix([[1,2,3], [4,5,6]]) B = Matrix([[7,8], [9, 1], [2,3]]) C = A*B<\/code><\/pre>\n<p>B Numpy \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435p \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e dot():<\/p>\n<pre><code class=\"python\">A = np.array([[1,2,3], [4,5,6]]) B = np.array([[7,8], [9, 1], [2,3]]) C = A.dot(B) print(C)<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0432\u0441\u0435. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u043c\u0435\u0442\u043e\u0434\u044b \u0413\u0430\u0443\u0441\u0441\u0430 \u0438 \u0416\u043e\u0440\u0434\u0430\u043d\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u041f\u0438\u0448\u0438\u0442\u0435, \u0447\u0442\u043e \u0435\u0449\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u043c\u043e\u0435\u043c \u0440\u0430\u0437\u0431\u043e\u0440\u0435. \u0414\u043b\u044f \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u043e \u043c\u043d\u043e\u0439: <a href=\"https:\/\/t.me\/Nikotineaddiction\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/Nikotineaddiction<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/746686\/\"> https:\/\/habr.com\/ru\/articles\/746686\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0443\u0437\u043d\u0430\u0435\u043c \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043a\u0430\u043a \u0435\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u0432 Python \u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043d\u0438\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 \u0438\u0437 m \u0441\u0442\u0440\u043e\u043a \u0438 n \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432.<\/p>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f\u043c:<\/p>\n<p>1) \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439.<\/p>\n<p>2) \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u043e \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439.<\/p>\n<p>3) \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0438\u043c\u0435\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u0438 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043e\u0434\u043d\u043e.<\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u043d\u0430 Python<\/h3>\n<p>\u0414\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Jupyter Notebook, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0441\u043a\u0430\u0447\u0430\u0432 <a href=\"https:\/\/www.anaconda.com\/download\" rel=\"noopener noreferrer nofollow\">Anaconda<\/a>. Jupyter \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432: 1) \u041c\u043d\u043e\u0433\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b, 2) \u0411\u043b\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434, \u0442.\u0435. \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e \u0447\u0430\u0441\u0442\u044f\u043c, 3) \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f Jyputer, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 Google Colab.<\/p>\n<p>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438 \u0432 Python \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f 2 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438: Sympy \u0438 Nympy. <\/p>\n<p><strong>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f Sympy:<\/strong><\/p>\n<p>\u0414\u0430\u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<pre><code class=\"python\">from sympy import * \u0410 = Matrix([[-3, 9, 2,4,0], [1,4,-1,3,-1], [0,2,-2,4,2], [3,1,0,-2,3]])<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u043c shape() (\u0442.\u0435. \u0443\u0437\u043d\u0430\u0435\u043c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0438 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0432 \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435)<\/p>\n<pre><code class=\"python\">shape(A)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0438\u043b\u0438 \u0441\u0442\u043e\u043b\u0431\u0435\u0446(\u043d\u0443\u043c\u0435\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 Python):<\/p>\n<pre><code class=\"python\">A.row(0) A.col(-1)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0438\u043b\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434 row_del() \u0438 col_del()<\/p>\n<pre><code class=\"python\">A.col_del(0) A.row_del(1)<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u043d\u0430 \u043a\u0430\u043a\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432\u044b \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0438\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443<\/p>\n<pre><code class=\"python\">M = Matrix([[1, 2], [-2, 0]]) M = M.row_insert(1, Matrix([[0, 4]])) M = M.col_insert(0, Matrix([1, -2, 3]))<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 Sympy \u0435\u0441\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<p>1) \u041d\u0443\u043b\u0435\u0432\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430<\/p>\n<pre><code class=\"python\">zeros(3,2)<\/code><\/pre>\n<p>2) \u041c\u0430\u0442\u0440\u0438\u0446\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446<\/p>\n<pre><code class=\"python\">ones(3,2)<\/code><\/pre>\n<p>3) \u0415\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430(\u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u044b, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0443\u043b\u0438)<\/p>\n<pre><code class=\"python\">eye(4)<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043f\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438:<\/p>\n<pre><code class=\"python\">diag(1,2,3)<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0445 \u0440\u0435\u0431\u044f\u0442 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0435 \u0448\u0442\u0443\u043a\u0438<\/p>\n<pre><code class=\"python\">diag(-1, ones(2,2), Matrix([5,7,5]))l<\/code><\/pre>\n<p><strong>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0432 Numpy<\/strong><\/p>\n<pre><code class=\"python\">import numpy as np<\/code><\/pre>\n<pre><code class=\"python\">C = np.array([[1,2,3], [4,5,6], [7,8,9]]) M = np.matrix([[1,2,3], [4,5,6], [7,8, 9]])<\/code><\/pre>\n<p>\u041d\u0443 \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 <\/p>\n<pre><code class=\"python\">H = np.matrix('1,2,3;4,5,6;7,8,9')<\/code><\/pre>\n<p>\u0412 Numpy \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435<\/p>\n<p>1) \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0438\u0437 \u043d\u0443\u043b\u0435\u0439<\/p>\n<pre><code class=\"python\">np.zeros((2,3))<\/code><\/pre>\n<p>2) \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0438\u0437 \u0435\u0434\u0438\u043d\u0438\u0446<\/p>\n<pre><code class=\"python\">np.ones((2,3))<\/code><\/pre>\n<p>3) \u0415\u0434\u0438\u043d\u0438\u0447\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430<\/p>\n<pre><code class=\"python\">np.eye(3)<\/code><\/pre>\n<p>\u0418 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0447\u0435\u0440\u0435\u0437 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c<\/p>\n<pre><code class=\"python\">np.diag([1,2,3])<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u044f \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438(\u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435)<\/p>\n<p><strong>\u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/strong><\/p>\n<p>\u0421\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 &#8212; \u0442.\u0435. \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u043a\u043e\u043b-\u0432\u043e \u0441\u0442\u0440\u043e\u043a \u0438 \u0441\u0442\u0440\u043e\u0447\u0435\u043a<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041d\u0430 Sympy:<\/p>\n<pre><code>A = Matrix([[1,2,3], [4,5,6], [7,8,9]]) B = Matrix([[1,2,3], [4,5,6], [7,8,9]]) print(A+B)<\/code><\/pre>\n<p>\u041d\u0430 Numpy:<\/p>\n<pre><code>A = np.array([[1,2,3], [4,5,6], [7,8,9]]) B = np.array([[1,2,3], [4,5,6], [7,8,9]]) print(A+B)<\/code><\/pre>\n<p>\u0421\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446<\/p>\n<p>1) A+B=B+A(\u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c)<\/p>\n<p>2) A+(B+C) = (A+B)+C(\u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c)<\/p>\n<p>3) \u0414\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u0430\u044f \u0435\u0439 (-A), \u0442\u0430\u043a\u0430\u044f \u0447\u0442\u043e \u0438\u0445 \u0441\u0443\u043c\u043c\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439<\/p>\n<p>\u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 Python \u043f\u043e \u0442\u0435\u043c \u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c.<\/p>\n<p>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0430 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0430\u043c\u044b\u043c \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0434\u043e\u043c\u043d\u043e\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0447\u0438\u0441\u043b\u043e  <\/p>\n<figure class=\"\"><\/figure>\n<p>\u0410 \u0432\u043e\u0442 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A \u0440\u0430\u0432\u043d\u043e \u0447\u0438\u0441\u043b\u0443 \u0441\u0442\u0440\u043e\u043a \u043c\u0430\u0442\u0440\u0438\u0446\u044b B. \u0415\u0441\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 A \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 (m*n), \u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 B \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440(k*n), \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 (m*n).<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0412 Sympy \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"python\">A = Matrix([[1,2,3], [4,5,6]]) B = Matrix([[7,8], [9, 1], [2,3]]) C = A*B<\/code><\/pre>\n<p>B Numpy \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435p \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e dot():<\/p>\n<pre><code class=\"python\">A = np.array([[1,2,3], [4,5,6]]) B = np.array([[7,8], [9, 1], [2,3]]) C = A.dot(B) print(C)<\/code><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0432\u0441\u0435. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u043c\u0435\u0442\u043e\u0434\u044b \u0413\u0430\u0443\u0441\u0441\u0430 \u0438 \u0416\u043e\u0440\u0434\u0430\u043d\u0430, \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u041f\u0438\u0448\u0438\u0442\u0435, \u0447\u0442\u043e \u0435\u0449\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u043c\u043e\u0435\u043c \u0440\u0430\u0437\u0431\u043e\u0440\u0435. \u0414\u043b\u044f \u043b\u0438\u0447\u043d\u043e\u0433\u043e \u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441\u043e \u043c\u043d\u043e\u0439: <a href=\"https:\/\/t.me\/Nikotineaddiction\" rel=\"noopener noreferrer nofollow\">https:\/\/t.me\/Nikotineaddiction<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/746686\/\"> https:\/\/habr.com\/ru\/articles\/746686\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-349950","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=349950"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349950\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=349950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=349950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=349950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}