{"id":295112,"date":"2019-11-24T21:00:20","date_gmt":"2019-11-24T21:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=295112"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=295112","title":{"rendered":"\u041c\u0435\u0442\u043e\u0434\u044b \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432: \u0442\u0435\u043a\u0441\u0442, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/477192\/\">\u041f\u0440\u043e\u0434\u043b\u043e\u0436\u0430\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0432\u043e\u0438\u0445 \u043b\u0435\u043a\u0446\u0438\u0439, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432, \u0443\u0447\u0430\u0449\u0438\u0445\u0441\u044f \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00ab\u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u0433\u0435\u043e\u043b\u043e\u0433\u0438\u044f\u00bb. \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u044d\u0442\u043e \u0443\u0436\u0435 \u0442\u0440\u0435\u0442\u044c\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0432\u0432\u043e\u0434\u043d\u043e\u0439, \u043e\u043d\u0430 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/429980\/\">\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a> \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u0430\u0436\u0435 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u0431\u0443\u0434\u0443 \u043c\u043d\u043e\u0433\u043e \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f: \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0443\u043c\u0435\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u044e \u0433\u043e\u043b\u043e\u0432\u0443 \u0432 \u0438\u0441\u0442\u0443\u043a\u0430\u043d\u0430 \u0441 \u043e\u0441\u0442\u0440\u043e\u0432\u0430 \u041f\u0430\u0441\u0445\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f48\/99d\/7c3\/f4899d7c3e2a6efed733108f90965c59.jpg\"><br \/>  <a name=\"habracut\"><\/a><br \/>  \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u043b\u0430\u043d \u043b\u0435\u043a\u0446\u0438\u0439:<\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/428768\/\">\u041b\u0438\u043a\u0431\u0435\u0437 \u043f\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u0435\u0439 (\u0441\u0442\u0430\u0442\u044c\u044f \u0432\u0432\u043e\u0434\u043d\u0430\u044f, \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f)<\/a>  <\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/post\/429980\/\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439<\/a>  <\/li>\n<li><b>\u041c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0437\u0430\u0434\u0430\u0447 \u041c\u041d\u041a<\/b>  <\/li>\n<li>\u041e\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u043a \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u043c \u0441\u0435\u0442\u044f\u043c  <\/li>\n<\/ul>\n<p>  \u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043a\u0443\u0440\u0441\u0430 <a href=\"https:\/\/github.com\/ssloy\/least-squares-course\/\">\u0436\u0438\u0432\u0451\u0442 \u0437\u0434\u0435\u0441\u044c<\/a>. \u041a\u043d\u0438\u0433\u0430 \u0435\u0449\u0451 \u043d\u0435 \u043e\u043a\u043e\u043d\u0447\u0435\u043d\u0430, \u044f \u043f\u043e\u0442\u0438\u0445\u043e\u043d\u044c\u043a\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e \u0432\u043e\u0435\u0434\u0438\u043d\u043e \u0441\u0442\u0430\u0442\u044c\u0438, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435.<\/p>\n<p>  \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439; \u043d\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u044d\u0442\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0433\u0434\u0435 \u0443 \u043d\u0435\u0433\u043e \u043a\u043d\u043e\u043f\u043a\u0430 \u0432\u043a\u043b\/\u0432\u044b\u043a\u043b. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0441\u0432\u0435\u0436\u0438\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f. <\/p>\n<h1>\u041c\u0430\u0442\u0440\u0438\u0446\u044b \u0438 \u0447\u0438\u0441\u043b\u0430<\/h1>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u0435 \u044f \u0431\u0443\u0434\u0443 \u043e\u0431\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435. \u041d\u0435 \u043f\u043e\u0434\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0442\u0435\u043a\u0441\u0442\u0443, \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u043f\u0430\u0443\u0437\u0443 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0430.<\/p>\n<h3>\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446<\/h3>\n<p>  \u041e\u0442\u0432\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0448\u043a\u0430\u0444\u0447\u0438\u043a, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0445\u0440\u0435\u043d\u043e\u0432\u0438\u043d\u044b. \u041a\u0430\u0436\u0434\u0430\u044f \u0445\u0440\u0435\u043d\u043e\u0432\u0438\u043d\u0430 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0441\u0432\u043e\u0435\u0439 \u044f\u0447\u0435\u0439\u043a\u0435, \u044f\u0447\u0435\u0439\u043a\u0438 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0440\u044f\u0434\u0430\u043c\u0438 \u0432 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u044b. \u0412 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0445\u0440\u0435\u043d\u043e\u0432\u0438\u043d\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430; \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u043a\u0430\u043a \u043d\u0435\u0447\u0442\u043e \u043d\u0430\u0432\u0440\u043e\u0434\u0435 <\/p>\n<pre><code class=\"cpp\">float A[m][n]; <\/code><\/pre>\n<p>  \u0417\u0430\u0447\u0435\u043c \u0436\u0435 \u0442\u0430\u043a\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043d\u0443\u0436\u043d\u044b? \u0427\u0442\u043e \u043e\u043d\u0438 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442? \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u044f \u0432\u0430\u0441 \u0440\u0430\u0441\u0441\u0442\u0440\u043e\u044e, \u043d\u043e \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043d\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e, \u043e\u043d\u0430 \u0445\u0440\u0430\u043d\u0438\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u0432\u0441\u044f\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b, \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math>. \u0427\u0442\u043e \u043e\u043d\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442? \u0414\u0430 \u0447\u0451\u0440\u0442 \u0435\u0433\u043e \u0437\u043d\u0430\u0435\u0442\u2026 \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430 \u0432\u0445\u043e\u0434 \u0431\u0435\u0440\u0451\u0442 \u043e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e, \u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434 \u0434\u0430\u0451\u0442 \u0434\u0440\u0443\u0433\u043e\u0435 \u0447\u0438\u0441\u043b\u043e:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fd5\/b98\/edd\/fd5b98edddb8a7851e232c0c8c988bda.svg\" alt=\"$ f(x) : \\mathbb R \\rightarrow \\mathbb R $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041e\u0434\u043d\u0443 \u0432\u0435\u0440\u0441\u0438\u044e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a \u043c\u043e\u0433 \u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a   <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/662\/a2e\/12a\/662a2e12a88b02a54ed0c0e83710c6c0.svg\" alt=\"$ f(x) = ax $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041d\u0443 \u0430 \u0432 \u043c\u0438\u0440\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u043e\u043d\u0430 \u0431\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">float f(float x) {     return a*x; } <\/code><\/pre>\n<p>  \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0430 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0434\u0440\u0443\u0433\u0443\u044e!  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/334\/75a\/00a\/33475a00afb022b13c3f6840cc67e8ff.svg\" alt=\"$ f(x) = ax^2 $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0420\u0430\u0437 \u0443\u0436 \u044f \u043d\u0430\u0447\u0430\u043b \u043f\u0440\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u044f \u043e\u0431\u044f\u0437\u0430\u043d \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0451 \u043a\u043e\u0434 \ud83d\ude42<\/p>\n<pre><code class=\"cpp\">float f(float x) {     return x*a*x; } <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f. \u041a\u0430\u043a\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f? \u0414\u0430 \u043d\u0438\u043a\u0430\u043a\u0430\u044f, \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u0447\u0438\u0441\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u044d\u0442\u043e\u0433\u043e, \u043e\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435! \u041a\u0430\u043a\u0443\u044e \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0442\u0430\u043a\u0443\u044e \u0438 \u0441\u0442\u0440\u043e\u0439\u0442\u0435.<\/p>\n<p>  \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438, \u044d\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430, \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b (\u0441\u043a\u0430\u043b\u044f\u0440\u043e\u0432) \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u0435\u043b. \u041d\u0430\u0434 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438, \u0440\u043e\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u043d\u0430\u0434 \u0447\u0438\u0441\u043b\u0430\u043c\u0438, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u043c\u0435\u0440\u0430 2&#215;2:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6d5\/36f\/f86\/6d536ff861aa9cd208a12f356977445e.svg\" alt=\"$ A=\\begin{bmatrix} a_{11} &amp; a_{12} \\\\ a_{21} &amp; a_{22}\\end{bmatrix} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u042d\u0442\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fee\/5cf\/f96\/fee5cff96ac64633a1db2f37d2274f87.svg\" alt=\"$ f(x) : \\mathbb R^2 \\rightarrow \\mathbb R^2, \\quad f(x) = Ax $\" data-tex=\"display\"><\/math><\/p>\n<pre><code class=\"cpp\">vector&lt;float&gt; f(vector&lt;float&gt; x) {     return vector&lt;float&gt;{a11*x[0] + a12*x[1],  a21*x[0] + a22*x[1]}; } <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u0432 \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440. \u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f: \u043d\u0430 \u0432\u0445\u043e\u0434 \u0434\u0430\u0451\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u0440\u0430\u0441\u0442\u044f\u043d\u0443\u0442\u0443\u044e \u0438\/\u0438\u043b\u0438 \u043f\u043e\u0432\u0451\u0440\u043d\u0443\u0442\u0443\u044e (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u0430\u0436\u0435 \u0437\u0435\u0440\u043a\u0430\u043b\u044c\u043d\u043e \u043e\u0442\u0440\u0430\u0436\u0451\u043d\u043d\u0443\u044e!) \u0432\u0435\u0440\u0441\u0438\u044e. \u041e\u0447\u0435\u043d\u044c \u0441\u043a\u043e\u0440\u043e \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0442\u0430\u043a\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446.<\/p>\n<p>  \u0410 \u043c\u043e\u0436\u043d\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0431\u0435 \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0432\u0443\u043c\u0435\u0440\u043d\u044b\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0432 \u0441\u043a\u0430\u043b\u044f\u0440:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/11e\/044\/20f\/11e04420ffc5c9e7535c06244ff56d5d.svg\" alt=\"$ f(x) : \\mathbb R^2 \\rightarrow \\mathbb R, \\quad f(x) = x^\\top A x = \\sum\\limits_i\\sum\\limits_j a_{ij}x_i x_j $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441 \u0432\u0435\u043a\u0442\u043e\u0440\u0430\u043c\u0438 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c-\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/28b\/71e\/46c\/28b71e46c10eacc1ca406c22908e2c94.svg\" alt=\"$x^2$\" data-tex=\"inline\"><\/math>, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u043b \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438. \u041e\u0447\u0435\u043d\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0442\u0435\u043c, \u043a\u0442\u043e \u043d\u0435 \u043f\u0440\u0438\u0432\u044b\u043a \u0441 \u043b\u0451\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0436\u043e\u043d\u0433\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u0435\u0449\u0451 \u0440\u0430\u0437 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446, \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b56\/e88\/48d\/b56e8848d8539afb701e449d3b23f819.svg\" alt=\"$x^\\top A x$\" data-tex=\"inline\"><\/math> \u0432\u043e\u043e\u0431\u0449\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u0430\u0451\u0442 \u0441\u043a\u0430\u043b\u044f\u0440 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044f\u0432\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043a\u043e\u0431\u043a\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f1b\/469\/77f\/f1b46977f8648136ffe25d8785cd2af7.svg\" alt=\"$x^\\top A x = (x^\\top A) x$\" data-tex=\"inline\"><\/math>. \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u044e, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/817\/b92\/407\/817b92407f764f57af9226e50cc788fd.svg\" alt=\"$x$\" data-tex=\"inline\"><\/math> \u2014 \u0432\u0435\u043a\u0442\u043e\u0440 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 2 (\u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u0432 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 2&#215;1), \u0432\u044b\u043f\u0438\u0448\u0435\u043c \u044f\u0432\u043d\u043e \u0432\u0441\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8db\/98e\/51e\/8db98e51e8da8e35258bbebdba2ff052.svg\" alt=\"$ \\underbrace{\\underbrace{\\left(\\underbrace{x^\\top}_{1\\times 2} \\times \\underbrace{A}_{2\\times 2}\\right)}_{1\\times 2} \\times \\underbrace{x}_{2\\times 1}}_{1 \\times 1} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u0432 \u0442\u0451\u043f\u043b\u044b\u0439 \u0438 \u043f\u0443\u0448\u0438\u0441\u0442\u044b\u0439 \u043c\u0438\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u0436\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">float f(vector&lt;float&gt; x) {     return x[0]*a11*x[0] + x[0]*a12*x[1] + x[1]*a21*x[0] + x[1]*a22*x[1]; } <\/code><\/pre>\n<p>  <\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e?<\/h3>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u044f \u0437\u0430\u0434\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u0433\u043b\u0443\u043f\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e? \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bb8\/584\/32f\/bb858432f47555a0d788db318e239a26.svg\" alt=\"$&gt;$\" data-tex=\"inline\"><\/math>. \u041d\u043e \u043d\u0435 \u0442\u043e\u0440\u043e\u043f\u0438\u0442\u0435\u0441\u044c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4cb\/d22\/2a5\/4cbd222a5ff310ffa53fed5931a66efe.svg\" alt=\"$a&gt;0$\" data-tex=\"inline\"><\/math>, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<h4>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 1<\/h4>\n<p>  \u0427\u0438\u0441\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u0433\u0434\u0430 \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8c6\/474\/963\/8c64749639b4c7a17dbea28eeb6a16eb.svg\" alt=\"$x\\in\\mathbb R,\\ x\\neq 0$\" data-tex=\"inline\"><\/math> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5dd\/06f\/bb4\/5dd06fbb464cd7e3c6b989877ef4fb04.svg\" alt=\"$ax^2&gt;0$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0443\u0434\u0440\u0451\u043d\u043e, \u043d\u043e \u0437\u0430\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c:<\/p>\n<h4>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 2<\/h4>\n<p>  \u041a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u0430\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439, \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u044b\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/817\/b92\/407\/817b92407f764f57af9226e50cc788fd.svg\" alt=\"$x$\" data-tex=\"inline\"><\/math> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/542\/e62\/7d8\/542e627d8755076c3cbe90425e085b9a.svg\" alt=\"$x^\\top A x &gt; 0$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0430 \u0432\u0435\u0437\u0434\u0435, \u043a\u0440\u043e\u043c\u0435 \u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442.<\/p>\n<p>  \u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c? \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u043c\u043e\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0410 \u0432\u0435\u0434\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0438\u0441\u043a\u0430\u0442\u044c, \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0435\u0434\u0443\u0440\u043d\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b! \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/58e\/6fe\/ce7\/58e6fece76b953a60f8ba3b1fb1d9d9a.svg\" alt=\"$f(x) = - x^2$\" data-tex=\"inline\"><\/math> \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443\u043e \u0447\u0438\u0441\u043b\u043e -1 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d93\/13f\/8d0\/d9313f8d06735d6988074f717265c2ac.svg\" alt=\"$f(x)$\" data-tex=\"inline\"><\/math> \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0443\u0431\u044b\u0432\u0430\u0435\u0442 \u0441 \u0440\u043e\u0441\u0442\u043e\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/817\/b92\/407\/817b92407f764f57af9226e50cc788fd.svg\" alt=\"$x$\" data-tex=\"inline\"><\/math>: \u0432\u0435\u0442\u0432\u0438 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d93\/13f\/8d0\/d9313f8d06735d6988074f717265c2ac.svg\" alt=\"$f(x)$\" data-tex=\"inline\"><\/math> \u0441\u043c\u043e\u0442\u0440\u044f\u0442 \u0432\u043d\u0438\u0437. \u041f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0445\u043e\u0440\u043e\u0448\u0438 \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u043f\u0430\u0440\u0430\u0431\u043e\u043b\u043e\u0438\u0434, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 (\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439) \u043c\u0438\u043d\u0438\u043c\u0443\u043c. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u0435\u043c\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043c\u0430\u0442\u0440\u0438\u0446 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/303\/35c\/97c\/30335c97ce60ce47f6b21cd4c3053ec6.svg\" alt=\"$2\\times 2$\" data-tex=\"inline\"><\/math>, \u043a\u0430\u043a \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0438 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u0445, \u0442\u0430\u043a \u0438 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c. \u0412\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u044f\u0434: \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/dce\/cd0\/359\/dcecd03593cb834b8711d17305a2885f.svg\" alt=\"$f(x):\\mathbb R^2 \\rightarrow \\mathbb R^2$\" data-tex=\"inline\"><\/math>. \u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u044f\u0434: \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0446\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446 \u043a\u0430\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffb\/ac3\/ca6\/ffbac3ca6b9e8d514864086070df1f96.svg\" alt=\"$f(x):\\mathbb R^2 \\rightarrow \\mathbb R$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3a6\/643\/df2\/3a6643df2c766dfcc74eefe972bdde60.png\"><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u044f \u0431\u0443\u0434\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0431\u0443\u0434\u0443\u0442 \u0435\u0449\u0451 \u0438 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c\u0438! \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e, \u043a\u043e\u0433\u0434\u0430 \u043b\u044e\u0434\u0438 \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043f\u0440\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0441\u0442\u044c, \u043e\u043d\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442 \u0435\u0449\u0451 \u0438 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c (\u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430) \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435\u043c.<\/p>\n<h3>\u041b\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435 \u043e \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u0442\u0440\u0438\u0446 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ba4\/8fb\/b5e\/ba48fbb5e625db3acaabacf10ded7899.svg\" alt=\"$x^\\top M x$\" data-tex=\"inline\"><\/math> \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/94d\/13e\/e0a\/94d13ee0aadd7f17977e0d279af38d42.svg\" alt=\"$M$\" data-tex=\"inline\"><\/math>; \u0437\u0430\u0442\u0435\u043c \u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/94d\/13e\/e0a\/94d13ee0aadd7f17977e0d279af38d42.svg\" alt=\"$M$\" data-tex=\"inline\"><\/math> \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0438 \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u043e\u0442\u043d\u0438\u043c\u0435\u043c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0435\u0451 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/99a\/a36\/8b6\/99aa368b6dd6ec604467755202fbfca0.svg\" alt=\"$ M = \\underbrace{\\frac{1}{2} (M+M^\\top)}_{:=M_s} + \\underbrace{\\frac{1}{2} (M-M^\\top)}_{:=M_a} = M_s + M_a $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bc3\/753\/3bf\/bc37533bf4067be459ea2f7277f03b89.svg\" alt=\"$M_s$\" data-tex=\"inline\"><\/math> \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/fe5\/870\/c61\/fe5870c61dbbf8e8a18118725ce16a67.svg\" alt=\"$M_s^\\top = M_s$\" data-tex=\"inline\"><\/math>; \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/76c\/7fb\/eb3\/76c7fbeb3c511231c9532e5057fed152.svg\" alt=\"$M_a$\" data-tex=\"inline\"><\/math> \u0430\u043d\u0442\u0438\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/84b\/2e1\/133\/84b2e11339027532ce796fb3b1cdab1f.svg\" alt=\"$M_a^\\top=-M_a$\" data-tex=\"inline\"><\/math>. \u041f\u0440\u0438\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0444\u0430\u043a\u0442\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0430\u043d\u0442\u0438\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 \u0442\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0432\u043d\u0430 \u043d\u0443\u043b\u044e. \u042d\u0442\u043e \u0432\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043d\u0430\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b1b\/253\/caa\/b1b253caa5318098bfe0ad8f0168ea4c.svg\" alt=\"$ q = x^\\top M_a x = (x^\\top M_a^\\top x)^\\top = - (x^\\top M_a x)^\\top = -q $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4fb\/15d\/c72\/4fb15dc720866e6bff45a2253e94f4a3.svg\" alt=\"$x^\\top M_a x$\" data-tex=\"inline\"><\/math> \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0440\u0430\u0432\u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d68\/cc4\/926\/d68cc4926bf74bae8fa3b51ca4a09ec8.svg\" alt=\"$q$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b74\/e5a\/677\/b74e5a67796ba303e6ffbfe4bb09000d.svg\" alt=\"$-q$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3c5\/846\/ebb\/3c5846ebb209965c2d46fc59e070f224.svg\" alt=\"$q\\equiv 0$\" data-tex=\"inline\"><\/math>. \u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u0432\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u0442\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/94d\/13e\/e0a\/94d13ee0aadd7f17977e0d279af38d42.svg\" alt=\"$M$\" data-tex=\"inline\"><\/math> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0430\u044f \u0444\u043e\u0440\u043c\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ba4\/8fb\/b5e\/ba48fbb5e625db3acaabacf10ded7899.svg\" alt=\"$x^\\top M x$\" data-tex=\"inline\"><\/math> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0430 \u0438 \u0447\u0435\u0440\u0435\u0437 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0443\u044e \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bc3\/753\/3bf\/bc37533bf4067be459ea2f7277f03b89.svg\" alt=\"$M_s$\" data-tex=\"inline\"><\/math>:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a9c\/c92\/8d5\/a9cc928d51804c3dd5684304eeefe2c5.svg\" alt=\"$ x^\\top M x = x^\\top (M_s + M_a) x = x^\\top M_s x + x^\\top M_a x = x^\\top M_s x. $\" data-tex=\"display\"><\/math><\/p>\n<h3>\u0418\u0449\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h3>\n<p>  \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043d\u0435\u043d\u0430\u0434\u043e\u043b\u0433\u043e \u0432 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0438\u0440; \u044f \u0445\u043e\u0447\u0443 \u043d\u0430\u0439\u0442\u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8f5\/06f\/1e3\/8f506f1e34a93f7e797d5f55dbd6c57c.svg\" alt=\"$f(x) = ax^2 - 2bx$\" data-tex=\"inline\"><\/math>. \u0427\u0438\u0441\u043b\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442; \u0447\u0442\u043e\u0431\u044b \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438, \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u044f\u0435\u043c \u043d\u0443\u043b\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0443\u044e: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d3a\/eff\/6f6\/d3aeff6f6b6de9c4673270e2ba559422.svg\" alt=\"$\\frac{d}{dx}f(x) = 0$\" data-tex=\"inline\"><\/math>. \u041f\u0440\u043e\u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u0443\u044e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0442\u0440\u0443\u0434\u0430 \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e21\/9fa\/c62\/e219fac627c1e0f45a51edb187bf82ea.svg\" alt=\"$\\frac{d}{dx}f(x) = 2ax - 2b = 0$\" data-tex=\"inline\"><\/math>; \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0448\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/81e\/de5\/9f3\/81ede59f3117946c38dbb3331ca2994d.svg\" alt=\"$ax-b=0$\" data-tex=\"inline\"><\/math>, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u0443\u0442\u0451\u043c \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7fb\/2d5\/a61\/7fb2d5a6149ace553d56c6e11650090f.svg\" alt=\"$x^* = b\/a$\" data-tex=\"inline\"><\/math>. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0432\u0443\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c: \u0440\u0435\u0448\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/81f\/580\/15d\/81f58015de04300eaa568f58a7236dd1.svg\" alt=\"$x^*$\" data-tex=\"inline\"><\/math> \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/81e\/de5\/9f3\/81ede59f3117946c38dbb3331ca2994d.svg\" alt=\"$ax-b=0$\" data-tex=\"inline\"><\/math> \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f8d\/1a6\/0d9\/f8d1a60d95ee179a581d7085b995fa5c.svg\" alt=\"$\\mathrm{argmin}_x(ax^2 - 2bx)$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/1ec\/ca4\/72a\/1ecca472a41d11570e808513c575be38.png\" width=\"480\"><\/p>\n<p>  \u042f \u043a\u043b\u043e\u043d\u044e \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0430\u0448\u0435\u0439 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u0446\u0435\u043b\u044c\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043c\u044b \u0436\u0435 \u043f\u0440\u043e \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0447\u0442\u043e \u043c\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u0430\u043a \u044d\u0442\u043e \u0440\u0435\u0448\u0430\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439). \u0418 \u043e\u0447\u0435\u043d\u044c \u0437\u0434\u043e\u0440\u043e\u0432\u043e, \u0447\u0442\u043e \u043e\u0434\u043d\u043e \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0434\u0440\u0443\u0433\u043e\u043c\u0443!<\/p>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c, \u0442\u0430\u043a \u044d\u0442\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u0430 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0432 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u0427\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043e\u043a\u0430\u0436\u0435\u043c \u0442\u0440\u0438 \u0442\u0435\u043e\u0440\u0435\u043c\u044b.<\/p>\n<h3>\u0422\u0440\u0438 \u0442\u0435\u043e\u0440\u0435\u043c\u044b, \u0438\u043b\u0438 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>  \u041f\u0435\u0440\u0432\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0433\u043b\u0430\u0441\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/125\/f92\/b2c\/125f92b2c5dbfe2ebdb17a2f3cec4ec9.svg\" alt=\"$1\\times 1$\" data-tex=\"inline\"><\/math> \u0438\u043d\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<h4>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 1<\/h4>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/32a\/ba4\/7d9\/32aba47d9517a5ca0860120beb3f12fb.svg\" alt=\"$x\\in \\mathbb R \\Rightarrow x^\\top = x$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438 \u044f \u0432\u044b\u043d\u0443\u0436\u0434\u0435\u043d \u0435\u0433\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b8f\/d31\/25c\/b8fd3125c4fdf398c13e15ada24bf8a4.svg\" alt=\"$\\frac{d}{dx}(bx) = b$\" data-tex=\"inline\"><\/math>, \u043d\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445?<\/p>\n<h4>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 2<\/h4>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0a2\/41b\/255\/0a241b255efed464516546af193c1bf9.svg\" alt=\"$\\nabla b^\\top x = \\nabla x^\\top b = b$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u044e\u0440\u043f\u0440\u0438\u0437\u043e\u0432, \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0442\u043e\u0433\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0448\u043a\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a48\/8f7\/de0\/a488f7de07994e04edd72d89c028a7be.svg\" alt=\"$\\nabla(b^\\top x) = \\begin{bmatrix}\\frac{\\partial (b^\\top x)}{\\partial x_1} \\\\ \\vdots \\\\ \\frac{\\partial (b^\\top x)}{\\partial x_n} \\end{bmatrix} = \\begin{bmatrix}\\frac{\\partial (b_1 x_1 + \\dots + b_n x_n)}{\\partial x_1} \\\\ \\vdots \\\\ \\frac{\\partial (b_1 x_1 + \\dots + b_n x_n)}{\\partial x_n} \\end{bmatrix} = \\begin{bmatrix}b_1 \\\\ \\vdots \\\\ b_n \\end{bmatrix} = b$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u0442\u0435\u043e\u0440\u0435\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/6da\/2de\/3726da2dee01b9d1b8e9073b54157962.svg\" alt=\"$b^\\top x = x^\\top b$\" data-tex=\"inline\"><\/math>, \u043c\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u043c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u043c \u0444\u043e\u0440\u043c\u0430\u043c. \u041c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/205\/afb\/3b2\/205afb3b2cb87416c8b5cb1d26c061e8.svg\" alt=\"$\\frac{d}{dx}(ax^2) = 2ax$\" data-tex=\"inline\"><\/math>, \u0430 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u044b?<\/p>\n<h4>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 3<\/h4>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/156\/892\/b63\/156892b63833ec87ab27df716283716f.svg\" alt=\"$\\nabla (x^\\top A x) = (A+A^\\top)x$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430, \u0442\u043e \u0442\u0435\u043e\u0440\u0435\u043c\u0430 \u0433\u043b\u0430\u0441\u0438\u0442, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/722\/e51\/0eb\/722e510eb05708768d491f582bef9fa0.svg\" alt=\"$\\nabla (x^\\top A x) = 2Ax$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u042d\u0442\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e \u0442\u043e\u0436\u0435 \u043f\u0440\u044f\u043c\u043e\u043b\u0438\u043d\u0435\u0439\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u043a\u0430\u043a \u0434\u0432\u043e\u0439\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/835\/690\/f6a\/835690f6ad319e1ae09cfebdec71a968.svg\" alt=\"$x^\\top A x = \\sum\\limits_i\\sum\\limits_j a_{ij} x_i x_j$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0410 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0435\u043c\u0443 \u0440\u0430\u0432\u043d\u0430 \u0447\u0430\u0441\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0430\u044f \u044d\u0442\u043e\u0439 \u0434\u0432\u043e\u0439\u043d\u043e\u0439 \u0441\u0443\u043c\u043c\u044b \u043f\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math>:<br \/>  \\begin{align*}<br \/>  \\frac{\\partial (x^\\top A x)}{\\partial x_i} <br \/>  &amp;= \\frac{\\partial}{\\partial x_i} \\left(\\sum\\limits_{k_1}\\sum\\limits_{k_2} a_{k_1 k_2} x_{k_1} x_{k_2}\\right) = \\\\<br \/>  &amp;= \\frac{\\partial}{\\partial x_i} \\left(<br \/>  \\underbrace{\\sum\\limits_{k_1\\neq i}\\sum\\limits_{k_2\\neq i} a_{ik_2}x_{k_1} x_{k_2}}_{k_1 \\neq i, k_2 \\neq i}+\\underbrace{\\sum\\limits_{k_2\\neq i} a_{ik_2}x_i x_{k_2}}_{k_1 = i, k_2\\neq i}+<br \/>  \\underbrace{\\sum\\limits_{k_1\\neq i} a_{k_1 i} x_{k_1} x_i}_{k_1 \\neq i, k_2 = i}+<br \/>  \\underbrace{a_{ii}x_i^2}_{k_1 = i, k_2 = i}\\right) = \\\\<br \/>  &amp; = \\sum\\limits_{k_2\\neq i} a_{ik_2}x_{k_2} + \\sum\\limits_{k_1\\neq i} a_{k_1 i} x_{k_1} + 2 a_{ii} x_i = \\\\<br \/>  &amp; = \\sum\\limits_{k_2} a_{ik_2}x_{k_2} + \\sum\\limits_{k_1} a_{k_1 i} x_{k_1} = \\\\<br \/>  &amp; = \\sum\\limits_{j} (a_{ij} + a_{ji}) x_j \\\\<br \/>  \\end{align*}<br \/>  \u042f \u0440\u0430\u0437\u0431\u0438\u043b \u0434\u0432\u043e\u0439\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u043c\u0438 \u0441\u043a\u043e\u0431\u043a\u0430\u043c\u0438. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435, \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0435 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/88a\/809\/c99\/88a809c990d420188e9a74d0b35658ef.svg\" alt=\"$\\nabla(x^\\top A x) = \\begin{bmatrix}\\frac{\\partial (x^\\top Ax)}{\\partial x_1} \\\\ \\vdots \\\\ \\frac{\\partial (x^\\top A x)}{\\partial x_n} \\end{bmatrix} = \\begin{bmatrix}\\sum\\limits_{j} (a_{1j} + a_{j1}) x_j \\\\ \\vdots \\\\ \\sum\\limits_{j} (a_{nj} + a_{jn}) x_j \\end{bmatrix} = (A+A^\\top)x $\" data-tex=\"display\"><\/math><\/p>\n<h3>\u041c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f. \u041c\u044b \u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0447\u0438\u0441\u043b\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/372\/e18\/546\/372e18546a3b7abb94c2672708bc5dfe.svg\" alt=\"$a$\" data-tex=\"inline\"><\/math> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0435\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u043c\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0448\u0438\u0442\u044c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/61a\/cbe\/df5\/61acbedf54c150f2ff8ec3f7d7ede0f9.svg\" alt=\"$ax=b$\" data-tex=\"inline\"><\/math> \u0438\u043b\u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/f8d\/1a6\/0d9\/f8d1a60d95ee179a581d7085b995fa5c.svg\" alt=\"$\\mathrm{argmin}_x(ax^2 - 2bx)$\" data-tex=\"inline\"><\/math> \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435.<\/p>\n<p>  \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math>.<br \/>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438   <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ae4\/384\/8fb\/ae43848fb4881887c874d8ba8d6c9230.svg\" alt=\"$\\mathrm{argmin}_{x\\in\\mathbb R^n} (x^\\top A x - 2b^\\top x).$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0420\u043e\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0432 \u0448\u043a\u043e\u043b\u0435, \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u044f\u0435\u043c \u043d\u0443\u043b\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u0443\u044e:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/869\/aa2\/a31\/869aa2a3158481d344c821dac1405638.svg\" alt=\"$\\nabla (x^\\top A x - 2b^\\top x) = \\begin{bmatrix}0 \\\\ \\vdots \\\\ 0 \\end{bmatrix}.$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0413\u0430\u043c\u0438\u043b\u044c\u0442\u043e\u043d\u0430 \u043b\u0438\u043d\u0435\u0435\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u0448\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/925\/931\/4d1\/9259314d14f6b0e93bab767ea7a13ce3.svg\" alt=\"$\\nabla (x^\\top A x) - 2\\nabla(b^\\top x) = \\begin{bmatrix}0 \\\\ \\vdots \\\\ 0 \\end{bmatrix}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0432\u0442\u043e\u0440\u0443\u044e \u0438 \u0442\u0440\u0435\u0442\u044c\u044e \u0442\u0435\u043e\u0440\u0435\u043c\u044b \u043e \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1e1\/79f\/492\/1e179f492014182a5c2c6a98c8cef662.svg\" alt=\"$(A+A^\\top)x - 2b = \\begin{bmatrix}0 \\\\ \\vdots \\\\ 0 \\end{bmatrix}$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430, \u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u0432\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u043d\u0430\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ba3\/15b\/925\/ba315b925695458943f90269738405d0.svg\" alt=\"$Ax = b$\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0423\u0440\u0430-\u0443\u0440\u0430, \u043f\u0435\u0440\u0435\u0439\u0434\u044f \u043e\u0442 \u043e\u0434\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043a \u043c\u043d\u043e\u0433\u0438\u043c, \u043c\u044b \u043d\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 \u0440\u043e\u0432\u043d\u044b\u043c \u0441\u0447\u0451\u0442\u043e\u043c \u043d\u0438\u0447\u0435\u0433\u043e, \u0438 \u043c\u043e\u0436\u0435\u043c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438!<\/p>\n<h1>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u043c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430\u043c<\/h1>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044e \u044d\u0442\u043e\u0439 \u043b\u0435\u043a\u0446\u0438\u0438. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bbf\/144\/f96\/bbf144f96565ddb2d3c1e3533b9f6ab4.svg\" alt=\"$(x_1, y_1)$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a97\/aa4\/f16\/a97aa4f1622ce5f12cb5b25a29a55f72.svg\" alt=\"$(x_2, y_2)$\" data-tex=\"inline\"><\/math>, \u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u0439\u0442\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u044f\u043c\u043e\u0439, \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0442\u043e\u0447\u043a\u0438. \u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u044f\u043c\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1b7\/eb7\/e10\/1b7eb7e10134b4d5941a76f67527cd3c.svg\" alt=\"$y = \\alpha x + \\beta$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u0435\u0441\u0442\u044c, \u043d\u0430\u0448\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u044d\u0442\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/723\/4a5\/2ba\/7234a52ba041cdb09b9328a047048fb2.svg\" alt=\"$\\alpha$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7fd\/b73\/0d9\/7fdb730d916a98c0ad71826e0bc706bf.svg\" alt=\"$\\beta$\" data-tex=\"inline\"><\/math>. \u042d\u0442\u043e \u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0435\u0434\u044c\u043c\u043e\u0433\u043e-\u0432\u043e\u0441\u044c\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0448\u043a\u043e\u043b\u044b, \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d29\/6bd\/1d4\/d296bd1d488e3497f4fdd3e7d604fa08.svg\" alt=\"$ \\left\\{ \\begin{split} \\alpha x_1 + \\beta &amp;= y_1\\\\ \\alpha x_2 + \\beta &amp;= y_2\\\\ \\end{split} \\right. $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0423 \u043d\u0430\u0441 \u0434\u0432\u0430 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441 \u0434\u0432\u0443\u043c\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c\u0438 (<math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/723\/4a5\/2ba\/7234a52ba041cdb09b9328a047048fb2.svg\" alt=\"$\\alpha$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7fd\/b73\/0d9\/7fdb730d916a98c0ad71826e0bc706bf.svg\" alt=\"$\\beta$\" data-tex=\"inline\"><\/math>), \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e.<\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0438 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0442\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/aef\/085\/64d\/aef08564d9045a5973f91b5063663b74.svg\" alt=\"$ \\underbrace{\\begin{bmatrix}x_1 &amp; 1 \\\\ x_2 &amp; 1 \\end{bmatrix}}_{:=A} \\underbrace{\\begin{bmatrix} \\alpha \\\\ \\beta \\end{bmatrix}}_{:=x} = \\underbrace{\\begin{bmatrix} y_1 \\\\ y_2 \\end{bmatrix}}_{:=b} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ba3\/15b\/925\/ba315b925695458943f90269738405d0.svg\" alt=\"$Ax = b$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d21\/81d\/1df\/d2181d1df29c57f4365bf360fc9c07e5.svg\" alt=\"$x^* = A^{-1}b$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c <b>\u0442\u0440\u0438<\/b> \u0442\u043e\u0447\u043a\u0438, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u044f\u043c\u0443\u044e:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d29\/6bd\/1d4\/d296bd1d488e3497f4fdd3e7d604fa08.svg\" alt=\"$ \\left\\{ \\begin{split} \\alpha x_1 + \\beta &amp;= y_1\\\\ \\alpha x_2 + \\beta &amp;= y_2\\\\ \\alpha x_3 + \\beta &amp;= y_3\\\\ \\end{split} \\right. $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0412 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5f4\/a38\/0c3\/5f4a380c313abc93909e6d603e0c2b4d.svg\" alt=\"$ \\underbrace{\\begin{bmatrix}x_1 &amp; 1 \\\\ x_2 &amp; 1 \\\\x_3 &amp; 1 \\end{bmatrix} }_{:= A\\,(3\\times 2)} \\underbrace{\\begin{bmatrix} \\alpha \\\\ \\beta \\end{bmatrix}}_{:=x\\,(2\\times 1)} = \\underbrace{\\begin{bmatrix} y_1 \\\\ y_2 \\\\ y_3 \\end{bmatrix}}_{:=b\\, (3\\times 1)} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0430\u044f, \u0438 \u0443 \u043d\u0435\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439! \u042d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0442\u0440\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u0438 \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u0441\u043e\u0432\u0435\u0440\u0435\u0448\u0435\u043d\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043c\u0438\u0440\u0435, \u043a\u043e\u0433\u0434\u0430 \u0442\u043e\u0447\u043a\u0438 \u2014 \u044d\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0448\u0443\u043c\u043b\u0451\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439, \u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/723\/4a5\/2ba\/7234a52ba041cdb09b9328a047048fb2.svg\" alt=\"$\\alpha$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7fd\/b73\/0d9\/7fdb730d916a98c0ad71826e0bc706bf.svg\" alt=\"$\\beta$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c <i>\u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u044e\u0442<\/i> \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439. \u041c\u044b \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0443\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u043b\u0435\u043a\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u0430\u043b\u0438 \u0431\u0435\u0437\u043c\u0435\u043d. \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0447\u0438\u0441\u0442\u043e \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0438 \u043e\u0447\u0435\u043d\u044c \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431.<\/p>\n<p>  \u041d\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u0438\u0434\u0435:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/237\/15c\/77b\/23715c77b8816a92c53551853c1d4911.svg\" alt=\"$ \\alpha \\underbrace{\\begin{bmatrix}x_1 \\\\ x_2 \\\\x_3 \\end{bmatrix} }_{:=\\vec{i}} +\\beta \\underbrace{\\begin{bmatrix}1 \\\\ 1 \\\\1 \\end{bmatrix} }_{:=\\vec{j}} = \\begin{bmatrix}y_1\\\\y_2\\\\y_3\\end{bmatrix} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0418\u043b\u0438, \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0442\u043a\u043e,   <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5c8\/159\/a46\/5c8159a46e4d82b0ab63b234f1227ce2.svg\" alt=\"$ \\alpha \\vec{i} + \\beta\\vec{j} = \\vec{b}. $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0412\u0435\u043a\u0442\u043e\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffc\/cda\/ee8\/ffccdaee804ec9b72fd7e423f6441010.svg\" alt=\"$\\vec i$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/626\/0cc\/58a\/6260cc58af78829e46e23268871b7b89.svg\" alt=\"$\\vec j$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/564\/9f9\/cb8\/5649f9cb8861267b6a0331555574c5b2.svg\" alt=\"$\\vec b$\" data-tex=\"inline\"><\/math> \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u043a\u0430\u043b\u044f\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/723\/4a5\/2ba\/7234a52ba041cdb09b9328a047048fb2.svg\" alt=\"$\\alpha$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7fd\/b73\/0d9\/7fdb730d916a98c0ad71826e0bc706bf.svg\" alt=\"$\\beta$\" data-tex=\"inline\"><\/math>.<br \/>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/4d7\/3dc\/a2a\/4d73dca2ae5453c4691281eae5be11b0.svg\" alt=\"$\\alpha \\vec{i} + \\beta\\vec{j}$\" data-tex=\"inline\"><\/math> \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u044c, \u0438 \u0435\u0441\u043b\u0438 \u0432\u0435\u043a\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/564\/9f9\/cb8\/5649f9cb8861267b6a0331555574c5b2.svg\" alt=\"$\\vec b$\" data-tex=\"inline\"><\/math> \u0432 \u044d\u0442\u043e\u0439 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438 \u043d\u0435 \u043b\u0435\u0436\u0438\u0442, \u0442\u043e \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442; \u043e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 \u043c\u044b \u0438\u0449\u0435\u043c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u0430\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e9d\/4c0\/f29\/e9d4c0f2946cabf134fca74736cfedaa.svg\" alt=\"$\\vec{e}(\\alpha, \\beta) := \\alpha \\vec{i} + \\beta\\vec{j} - \\vec b$\" data-tex=\"inline\"><\/math>. \u041d\u0430\u0448\u0435\u0439 \u0437\u0430\u0447\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/723\/4a5\/2ba\/7234a52ba041cdb09b9328a047048fb2.svg\" alt=\"$\\alpha$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/7fd\/b73\/0d9\/7fdb730d916a98c0ad71826e0bc706bf.svg\" alt=\"$\\beta$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u0434\u043b\u0438\u043d\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3a6\/952\/586\/3a695258643cec123784a303397845ac.svg\" alt=\"$\\vec{e}(\\alpha, \\beta)$\" data-tex=\"inline\"><\/math>. \u0418\u043d\u0430\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e57\/462\/3e6\/e574623e650f18a9cc1fd65393c70f4c.svg\" alt=\"$\\mathrm{argmin}_{\\alpha, \\beta} \\|\\vec{e}(\\alpha, \\beta)\\|$\" data-tex=\"inline\"><\/math>.<br \/>  \u0412\u043e\u0442 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f:.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/10b\/fce\/f8b\/10bfcef8bb867a80c6fa0db3c670ff2f.png\"><\/p>\n<p>  \u0418\u043c\u0435\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0435\u043a\u0442\u043e\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffc\/cda\/ee8\/ffccdaee804ec9b72fd7e423f6441010.svg\" alt=\"$\\vec i$\" data-tex=\"inline\"><\/math>, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/626\/0cc\/58a\/6260cc58af78829e46e23268871b7b89.svg\" alt=\"$\\vec j$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/564\/9f9\/cb8\/5649f9cb8861267b6a0331555574c5b2.svg\" alt=\"$\\vec b$\" data-tex=\"inline\"><\/math>, \u043c\u044b \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bde\/347\/543\/bde3475436ef0cb2c36c2044231158a0.svg\" alt=\"$\\vec e$\" data-tex=\"inline\"><\/math>. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0433\u043e \u0434\u043b\u0438\u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0435\u0440\u043f\u0435\u043d\u0434\u0438\u043a\u0443\u043b\u044f\u0440\u0435\u043d \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u043d\u0430\u0442\u044f\u043d\u0443\u0442\u043e\u0439 \u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffc\/cda\/ee8\/ffccdaee804ec9b72fd7e423f6441010.svg\" alt=\"$\\vec i$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/626\/0cc\/58a\/6260cc58af78829e46e23268871b7b89.svg\" alt=\"$\\vec j$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041d\u043e \u043f\u043e\u0441\u0442\u043e\u0439\u0442\u0435, \u0433\u0434\u0435 \u0436\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b? \u0421\u0435\u0439\u0447\u0430\u0441 \u0431\u0443\u0434\u0443\u0442. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u043d\u044f <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3e8\/a24\/d12\/3e8a24d12b54a7ffcfdf682be7d5507f.svg\" alt=\"$\\sqrt{\\cdot}$\" data-tex=\"inline\"><\/math> \u043c\u043e\u043d\u043e\u0442\u043e\u043d\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e57\/462\/3e6\/e574623e650f18a9cc1fd65393c70f4c.svg\" alt=\"$\\mathrm{argmin}_{\\alpha, \\beta} \\|\\vec{e}(\\alpha, \\beta)\\|$\" data-tex=\"inline\"><\/math> = <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d09\/ea5\/6bc\/d09ea56bc86f6455b659d17a258952b1.svg\" alt=\"$\\mathrm{argmin}_{\\alpha, \\beta} \\|\\vec{e}(\\alpha, \\beta)\\|^2$\" data-tex=\"inline\"><\/math>!<\/p>\n<p>  \u0412\u043f\u043e\u043b\u043d\u0435 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043e\u043d \u043f\u0435\u0440\u043f\u0435\u043d\u0434\u0438\u043a\u0443\u043b\u044f\u0440\u0435\u043d \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u043d\u0430\u0442\u044f\u043d\u0443\u0442\u043e\u0439 \u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ffc\/cda\/ee8\/ffccdaee804ec9b72fd7e423f6441010.svg\" alt=\"$\\vec i$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/626\/0cc\/58a\/6260cc58af78829e46e23268871b7b89.svg\" alt=\"$\\vec j$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u043f\u0440\u0438\u0440\u0430\u0432\u043d\u044f\u0432 \u043d\u0443\u043b\u044e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d29\/6bd\/1d4\/d296bd1d488e3497f4fdd3e7d604fa08.svg\" alt=\"$ \\left\\{ \\begin{split}\\vec{i}^\\top \\vec{e}(\\alpha, \\beta) &amp;= 0\\\\ \\vec{j}^\\top \\vec{e}(\\alpha, \\beta) &amp;= 0 \\end{split} \\right. $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0412 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u044d\u0442\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/bac\/a09\/c65\/baca09c65cdcca7e0d59a3e37bdceabb.svg\" alt=\"$ \\begin{bmatrix}x_1 &amp; x_2 &amp; x_3 \\\\ 1 &amp; 1 &amp; 1 \\end{bmatrix} \\left(\\alpha \\begin{bmatrix}x_1 \\\\ x_2 \\\\x_3 \\end{bmatrix} +\\beta \\begin{bmatrix}1 \\\\ 1 \\\\1 \\end{bmatrix} - \\begin{bmatrix}y_1\\\\y_2\\\\y_3\\end{bmatrix}\\right) = \\begin{bmatrix}0\\\\0\\end{bmatrix} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0438\u043b\u0438 \u0436\u0435  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/201\/dcf\/d54\/201dcfd54b7d1479f9dc41c28c92e247.svg\" alt=\"$ \\begin{bmatrix}x_1 &amp; x_2 &amp; x_3 \\\\ 1 &amp; 1 &amp; 1 \\end{bmatrix} \\left( \\begin{bmatrix}x_1 &amp; 1 \\\\ x_2 &amp; 1 \\\\x_3 &amp; 1 \\end{bmatrix} \\begin{bmatrix} \\alpha \\\\ \\beta \\end{bmatrix}- \\begin{bmatrix} y_1 \\\\ y_2 \\\\ y_3 \\end{bmatrix} \\right) = \\begin{bmatrix}0\\\\0\\end{bmatrix} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u041d\u043e \u043c\u044b \u043d\u0430 \u044d\u0442\u043e\u043c \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/764\/bac\/7dd\/764bac7dd28d9fef4a4672ee2d76a7ea.svg\" alt=\"$ A^\\top (Ax - b)= \\begin{bmatrix}0\\\\0\\end{bmatrix} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0418 \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/8e6\/27f\/9cb\/8e627f9cbd555f94225df9bbfa6454f4.svg\" alt=\"$ A^\\top Ax = A^\\top b. $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/65f\/d84\/d96\/65fd84d96d21f792fbe18b3156c742ff.svg\" alt=\"$3\\times 2$\" data-tex=\"inline\"><\/math>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/303\/35c\/97c\/30335c97ce60ce47f6b21cd4c3053ec6.svg\" alt=\"$2\\times 2$\" data-tex=\"inline\"><\/math>. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/302\/c72\/04e\/302c7204ea9987e698a70307646abd71.svg\" alt=\"$b$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d90\/0b5\/b5e\/d900b5b5e49894a0993be56b6a548300.svg\" alt=\"$3\\times 1$\" data-tex=\"inline\"><\/math>, \u043d\u043e \u0432\u0435\u043a\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/b19\/b61\/182\/b19b61182b995384d5fd1f2f54d06c95.svg\" alt=\"$A^\\top b$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/896\/ef6\/1c4\/896ef61c44b756ec09504c2869a0476a.svg\" alt=\"$2\\times 1$\" data-tex=\"inline\"><\/math>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0430! \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u0435\u0449\u0451 \u043f\u0430\u0440\u0443 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432.<\/p>\n<h4>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 4<\/h4>\n<p>  <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u0430.<\/p>\n<p>  \u042d\u0442\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/69a\/2e6\/38f\/69a2e638f59bc0820acdb4c6d65bcf96.svg\" alt=\"$ (A^\\top A)^\\top = A^\\top (A^\\top)^\\top = A^\\top A. $\" data-tex=\"display\"><\/math><\/p>\n<h4>\u0422\u0435\u043e\u0440\u0435\u043c\u0430 5<\/h4>\n<p>   <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430: <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/25d\/f92\/c2f\/25df92c2fd43f3c835d22369e2d99b52.svg\" alt=\"$\\forall x\\in \\mathbb R^n\\quad x^\\top A^\\top A x \\geq 0.$\" data-tex=\"inline\"><\/math><\/p>\n<p>  \u042d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0442\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430, \u0447\u0442\u043e <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1cd\/990\/c32\/1cd990c327216f0806bf5bd0e6db4a88.svg\" alt=\"$x^\\top A^\\top A x = (A x)^\\top A x &gt; 0$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u0438\u043c\u0435\u0435\u0442 \u043b\u0438\u043d\u0435\u0439\u043d\u043e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b (\u0440\u0430\u043d\u0433 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u0435\u043d \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435).<\/p>\n<p>  \u0418\u0442\u043e\u0433\u043e, \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 \u0434\u0432\u0443\u043c\u044f \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u043c\u044b \u0434\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d09\/ea5\/6bc\/d09ea56bc86f6455b659d17a258952b1.svg\" alt=\"$\\mathrm{argmin}_{\\alpha, \\beta} \\|\\vec{e}(\\alpha, \\beta)\\|^2$\" data-tex=\"inline\"><\/math> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/66a\/73b\/2ca\/66a73b2cad62f6173ff34c333bb804c7.svg\" alt=\"$A^\\top A x = A^\\top b$\" data-tex=\"inline\"><\/math>. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0432\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c\u043e \u0438 \u043a \u043b\u044e\u0431\u043e\u043c\u0443 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u043e\u043c. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432, \u043f\u0440\u0438\u0434\u0451\u043c \u043a \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0433\u043e \u043d\u0430\u043c \u0432\u0438\u0434\u0430, \u0438 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u043e\u0431 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439. \u0418\u0442\u0430\u043a, \u043f\u043e\u0435\u0445\u0430\u043b\u0438:  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/1b8\/54d\/440\/1b854d44003f175d56fe476eed7a5275.svg\" alt=\"$ \\begin{split} \\mathrm{argmin} \\| Ax - b \\|^2 &amp;= \\mathrm{argmin} (Ax-b)^\\top (Ax-b) =\\\\ &amp; = \\mathrm{argmin}(x^\\top A^\\top - b^\\top)(Ax-b) = \\\\ &amp; = \\mathrm{argmin}(x^\\top A^\\top A x - b^\\top Ax - x^\\top A^\\top b + \\underbrace{b^\\top b}_{\\rm const})=\\\\ &amp; = \\mathrm{argmin}(x^\\top A^\\top A x - 2b^\\top Ax) = \\\\ &amp; = \\mathrm{argmin}(x^\\top \\underbrace{(A^\\top A)}_{:=A'} x - 2\\underbrace{(A^\\top b)}_{:=b'}\\phantom{}^\\top x) \\end{split} $\" data-tex=\"display\"><\/math><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c5d\/5a7\/876\/c5d5a7876250a6d91411a816b03ae669.svg\" alt=\"$\\mathrm{argmin} \\| Ax - b \\|^2$\" data-tex=\"inline\"><\/math> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u0430 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ed4\/3c4\/3d8\/ed43c43d887c47d658444ef1199d1d87.svg\" alt=\"$\\mathrm{argmin} (x^\\top A' x - 2b'^\\top x)$\" data-tex=\"inline\"><\/math> \u0441 (\u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435) \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0439 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/20b\/40d\/a9e\/20b40da9efe9f6a915fd2d27e3b907a4.svg\" alt=\"$A'$\" data-tex=\"inline\"><\/math>, \u0447\u0442\u043e, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/afe\/01b\/094\/afe01b0948125a661791cd63290e8948.svg\" alt=\"$A'x = b'$\" data-tex=\"inline\"><\/math>. \u0423\u0444\u0444. \u0422\u0435\u043e\u0440\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c.<\/p>\n<h1>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h1>\n<p>  <\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0432\u044b\u0439, \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0439<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043e\u0434\u0438\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 <a href=\"https:\/\/habr.com\/ru\/post\/429980\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>:<\/p>\n<pre><code class=\"python\"># initialize the data array x = [0.] * 32 x[0] = x[31] = 1. x[18] = 2.  # smooth the array values other than at indices 0,18,31 for iter in range(1000):     for i in range(len(x)):         if i in [0,18,31]: continue         x[i] = (x[i-1] + x[i+1])\/2. <\/code><\/pre>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 x \u0438\u0437 32 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/55c\/2af\/514\/55c2af5146833717a30239384c5fe0f6.png\"><\/p>\n<p>  \u0410 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0442\u044b\u0441\u044f\u0447\u0443 \u0440\u0430\u0437 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0438 x[i] \u043c\u044b \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u0451 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u044f\u0447\u0435\u0435\u043a: x[i] = ( x[i-1] + x[i+1] )\/2. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435: \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u043e\u0434 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 0, 18 \u0438 31. \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0445 \u0441\u0442\u0430 \u043f\u044f\u0442\u0438\u0434\u0435\u0441\u044f\u0442\u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/afd\/b9e\/708\/afdb9e708f0046324b2937ac6f6210b4.gif\"><\/p>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/429980\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u0430\u0448 \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u043c\u0435\u0433\u0430\u043a\u043e\u0434 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 \u0440\u0435\u0448\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0413\u0430\u0443\u0441\u0441\u0430-\u0417\u0435\u0439\u0434\u0435\u043b\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/262\/944\/501\/262944501d4e5523ee4b51008799c4f0.png\"><\/p>\n<p>  \u0412\u044b\u044f\u0441\u043d\u0438\u0442\u044c-\u0442\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u043d\u043e \u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0437\u044f\u043b\u0430\u0441\u044c \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430? \u0427\u0442\u043e \u0437\u0430 \u043c\u0430\u0433\u0438\u044f? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u0432\u043b\u0435\u0447\u0451\u043c\u0441\u044f \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443. \u0423 \u043c\u0435\u043d\u044f \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0435\u0441\u0442\u044c 32 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0432\u0441\u0435-\u0432\u0441\u0435-\u0432\u0441\u0435 \u0431\u044b\u043b\u0438 \u0440\u0430\u0432\u043d\u044b \u043e\u0434\u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439. \u042d\u0442\u043e \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0433\u043b\u0430\u0441\u0438\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043f\u0430\u0440\u043d\u043e \u0440\u0430\u0432\u043d\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/dfe\/27a\/bf7\/dfe27abf7e324e0adfe9d4432e7fad47.png\"><\/p>\n<p>  \u0412\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0439 \u043a\u043e\u0434 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0435 \u0442\u0440\u043e\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0440\u0451\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445: x0, x18, x31, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0451\u043c \u0432 \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u0442.\u0435., \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u043c \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/216\/5e0\/c7c\/2165e0c7cee16e902a36778abb680bed.png\"><\/p>\n<p>  \u042f \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 x0=1, \u043f\u0435\u0440\u0432\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e x1 = x0 = 1, \u0432\u0442\u043e\u0440\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e x2=x1=x0=1 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435, \u043f\u043e\u043a\u0443\u0434\u0430 \u043c\u044b \u043d\u0435 \u0434\u043e\u0439\u0434\u0451\u043c \u0434\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f 1 = x0 = x17 = x18 = 2. \u041e\u0439. \u0410 \u0432\u0435\u0434\u044c \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f :((<\/p>\n<p>  \u0410 \u0438 \u043f\u043e\u0444\u0438\u0433, \u043c\u044b \u0436\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b! \u041d\u0430\u0448\u0430 \u043d\u0435\u0440\u0435\u0448\u0430\u0435\u043c\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u043e\u043c \u0432\u0438\u0434\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ba3\/15b\/925\/ba315b925695458943f90269738405d0.svg\" alt=\"$Ax=b$\" data-tex=\"inline\"><\/math>; \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0451\u043d\u043d\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/66a\/73b\/2ca\/66a73b2cad62f6173ff34c333bb804c7.svg\" alt=\"$A^\\top Ax=A^\\top b$\" data-tex=\"inline\"><\/math>. \u0410 \u0442\u0443\u0442 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0440\u043e\u0432\u043d\u043e, \u043e\u0434\u0438\u043d-\u0432-\u043e\u0434\u0438\u043d \u0442\u0430 \u0441\u0430\u043c\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438!<\/p>\n<p>  \u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0435\u0431\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u043c\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0430\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u043e\u0442\u0438\u043c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/42f\/173\/c29\/42f173c2992cf2826d484e0dac62fb74.svg\" alt=\"$x_i$\" data-tex=\"inline\"><\/math> \u0431\u044b\u043b \u0440\u0430\u0432\u0435\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5f1\/3eb\/28d\/5f13eb28dc3d4967946966fa3898e8e9.svg\" alt=\"$x_{i+1}$\" data-tex=\"inline\"><\/math>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/0a2\/952\/602\/0a29526023fd4aef2f0b8033aa70cd0e.svg\" alt=\"$x_i - x_{i+1}=0$\" data-tex=\"inline\"><\/math>, \u0432\u0435\u0448\u0430\u044f \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0445 \u0441\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f x0, x18 \u0438 x31 \u0436\u0451\u0441\u0442\u043a\u043e \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c \u043d\u0435 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e, \u043a\u0430\u043a \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u0442\u044f\u043d\u0443\u0442\u044c \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0438, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u044f (\u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435) \u043a\u0443\u0441\u043e\u0447\u043d\u043e-\u043b\u0438\u043d\u0435\u0439\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435.<\/p>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u0440\u0435\u0448\u0430\u044e\u0449\u0443\u044e \u044d\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439. \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0413\u0430\u0443\u0441\u0441\u0430-\u0417\u0435\u0439\u0434\u0435\u043b\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0443\u044e \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0435 \u0440\u0435\u0448\u0430\u0442\u0435\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439. \u0412 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">import numpy as np  n = 32 # size of the vector to produce  # fill the matrix with 2nd order finite differences A = np.matrix(np.zeros((n-1, n))) for i in range(0,n-1):     A[i, i]   = -1.     A[i, i+1] =  1.  # eliminate the constrained variables from the matrix A = A[:,[*range(1,18)] + [*range(19,31)]]  b = np.matrix(np.zeros((n-1, 1))) b[0,0]   =  1. b[17,0] = -2. b[18,0]   =  2. b[n-2,0] = -1.  # solve the system x = np.linalg.inv(A.transpose()*A)*A.transpose()*b x = x.transpose().tolist()[0]  # re-introduce the constrained variables x.insert(0, 1.) x.insert(18, 2.) x.append(1.) <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a x \u0438\u0437 32 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041c\u044b \u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math>, \u0441\u0442\u0440\u043e\u0438\u043c \u0432\u0435\u043a\u0442\u043e\u0440 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/302\/c72\/04e\/302c7204ea9987e698a70307646abd71.svg\" alt=\"$b$\" data-tex=\"inline\"><\/math>, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0435\u043a\u0442\u043e\u0440 \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e2a\/3f3\/e23\/e2a3f3e23125d9a8c6ef1e4c1bc03746.svg\" alt=\"$x = (A^\\top A)^{-1}A^\\top b$\" data-tex=\"inline\"><\/math>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432 \u044d\u0442\u043e\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0448\u0438 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f x0=1, x18=2 \u0438 x31=1.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u0442\u044c \u0432 \u043f\u0440\u0430\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u041d\u0435\u043b\u044c\u0437\u044f \u043b\u0438 \u0441\u0445\u0438\u0442\u0440\u0438\u0442\u044c? \u041c\u043e\u0436\u043d\u043e! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">import numpy as np  n = 32 # size of the vector to produce  # fill the matrix with 2nd order finite differences A = np.matrix(np.zeros((n-1+3, n))) for i in range(0,n-1):     A[i, i]   = -1.     A[i, i+1] =  1.  # enforce the constraints through the quadratic penalty A[n-1+0, 0] = 100. A[n-1+1,18] = 100. A[n-1+2,31] = 100.  b = np.matrix(np.zeros((n-1+3, 1))) b[n-1+0,0] = 100.*1. b[n-1+1,0] = 100.*2. b[n-1+2,0] = 100.*1.  # solve the system x = np.linalg.inv(A.transpose()*A)*A.transpose()*b x = x.transpose().tolist()[0] <\/code><\/pre>\n<p>  \u0421 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043e\u043d \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435, \u0432\u0435\u043a\u0442\u043e\u0440 x \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043d\u0443\u0436\u043d\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438, \u0434\u0430 \u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b A \u0438 b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043a\u0443\u0434\u0430 \u043a\u0430\u043a \u043f\u0440\u043e\u0449\u0435. \u041d\u043e \u0432 \u0447\u0451\u043c \u0436\u0435 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/5e9\/d48\/bd3\/5e9d48bd3c83d7a7a6f14ea09b61585f.png\"><\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0442\u0440\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f:<br \/>  100 x0 = 100 * 1 <br \/>  100 x18 = 100 * 2<br \/>  100 x31 = 100 * 1<\/p>\n<p>  \u041d\u0435 \u043f\u0440\u043e\u0449\u0435 \u043b\u0438 \u0431\u044b\u043b\u043e \u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c?<br \/>  x0 = 1 <br \/>  x18 = 2<br \/>  x31 = 1<\/p>\n<p>  \u041d\u0435\u0442, \u043d\u0435 \u043f\u0440\u043e\u0449\u0435. \u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u043a\u0430\u0436\u0434\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0432\u0435\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0438, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 x0 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c 1, \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0443 \u043c\u0435\u0436\u0434\u0443 x18 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c 2 \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f x31 \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u0435\u0434\u0438\u043d\u0438\u0446\u0435.<\/p>\n<p>  \u041d\u043e \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 100 \u0442\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a. \u041c\u044b \u0436\u0435 \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043d\u0435 \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f, \u043c\u044b \u0440\u0435\u0448\u0430\u0435\u043c \u0435\u0451 \u0432 \u0441\u043c\u044b\u0441\u043b\u0435 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432, \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0423\u043c\u043d\u043e\u0436\u0438\u0432 \u043d\u0430 100 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0442\u0440\u0451\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u043c\u044b \u0432\u0432\u043e\u0434\u0438\u043c \u0448\u0442\u0440\u0430\u0444 \u0437\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 x0, x18 \u0438 x32 \u043e\u0442 \u043d\u0443\u0436\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432 \u0434\u0435\u0441\u044f\u0442\u044c \u0442\u044b\u0441\u044f\u0447 \u0440\u0430\u0437 (100^2) \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u044e\u0449\u0438\u0439 \u0448\u0442\u0440\u0430\u0444 \u0437\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u0435 \u043e\u0442 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/675\/657\/5b7\/6756575b7c212bd035374526ac72daa9.svg\" alt=\"$x_i = x_{i+1}$\" data-tex=\"inline\"><\/math>. \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0438 \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0442\u0440\u0451\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u0445 \u0432 \u0434\u0435\u0441\u044f\u0442\u044c \u0442\u044b\u0441\u044f\u0447 \u0440\u0430\u0437 \u0431\u043e\u043b\u0435\u0435 \u0436\u0451\u0441\u0442\u043a\u0438\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u043d\u0430 \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u0448\u0442\u0440\u0430\u0444\u0430 \u2014 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439, \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043f\u0440\u043e\u0449\u0435 (\u0445\u043e\u0442\u044f \u0438 \u043d\u0435 \u0431\u0435\u0437 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432), \u043d\u0435\u0436\u0435\u043b\u0438 \u0440\u0435\u0434\u0443\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0442\u043e\u0440\u043e\u0439, \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u044b\u0439<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0436\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u0447\u0435\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443, \u043d\u0435\u0436\u0435\u043b\u0438 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430! \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0440\u043e\u0432\u043d\u043e \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c. \u042f \u0445\u043e\u0447\u0443 \u0432\u0437\u044f\u0442\u044c \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u0443\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0433\u0440\u0430\u043d\u0438\u0446\u0443, \u0430 \u0432\u0441\u044e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0433\u043b\u0430\u0434\u0438\u0442\u044c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b3f\/fc2\/9eb\/b3ffc29ebc257d031baa5d18e85319ad.jpg\"><\/p>\n<p>  \u041a\u043e\u0434 <a href=\"https:\/\/github.com\/ssloy\/least-squares-course\/tree\/e19236b7aadf6d544979e50a1c2cd03e0ee00fb2\/head-smooth\">\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u0443\u0442<\/a>, \u043d\u043e \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u043e\u043b\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"cpp\">#include &lt;vector&gt; #include &lt;iostream&gt;  #include \"OpenNL_psm.h\" #include \"geometry.h\" #include \"model.h\"  int main(int argc, char** argv) {     if (argc&lt;2) {         std::cerr &lt;&lt; \"Usage: \" &lt;&lt; argv[0] &lt;&lt; \" obj\/model.obj\" &lt;&lt; std::endl;         return 1;     }      Model m(argv[1]);      for (int d=0; d&lt;3; d++) { \/\/ solve for x, y and z separately         nlNewContext();         nlSolverParameteri(NL_NB_VARIABLES, m.nverts());         nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);         nlBegin(NL_SYSTEM);         nlBegin(NL_MATRIX);          for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ fix the boundary vertices             if (m.opp(i)!=-1) continue;             int v = m.from(i);             nlRowScaling(100.);             nlBegin(NL_ROW);             nlCoefficient(v,  1);             nlRightHandSide(m.point(v)[d]);             nlEnd(NL_ROW);         }          for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ smooth the interior             if (m.opp(i)==-1) continue;             int v1 = m.from(i);             int v2 = m.to(i);              nlRowScaling(1.);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlEnd(NL_ROW);         }          nlEnd(NL_MATRIX);         nlEnd(NL_SYSTEM);         nlSolve();          for (int i=0; i&lt;m.nverts(); i++) {             m.point(i)[d] = nlGetVariable(i);         }     }      std::cout &lt;&lt; m;     return 0; } <\/code><\/pre>\n<p>  \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043f\u0430\u0440\u0441\u0435\u0440 wavefront .obj \u0444\u0430\u0439\u043b\u043e\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0434\u0435\u043b\u044c\u043a\u0430 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u0447\u043a\u0443. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0440\u0435\u0448\u0430\u0442\u0435\u043b\u044f \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c OpenNL, \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u0439 \u0440\u0435\u0448\u0430\u0442\u0435\u043b\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u0440\u0435\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043c\u0430\u0442\u0440\u0438\u0446 \u0443 \u043d\u0430\u0441 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0433\u0438\u0433\u0430\u043d\u0442\u0441\u043a\u0438\u043c\u0438: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\/\u0431 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 1000 x 1000 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u043d\u0430 \u043c\u0438\u043b\u043b\u0438\u043e\u043d! \u041e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043d\u0443\u043b\u0435\u0432\u044b\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0451 \u043d\u0435 \u0442\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u043d\u043e, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043e\u043b\u0432\u0435\u0440\u044b.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043a\u043e\u0434. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e \u0441\u043e\u043b\u0432\u0435\u0440\u0443, \u0447\u0442\u043e \u044f \u0445\u043e\u0447\u0443 \u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">        nlNewContext();         nlSolverParameteri(NL_NB_VARIABLES, m.nverts());         nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);         nlBegin(NL_SYSTEM);         nlBegin(NL_MATRIX); <\/code><\/pre>\n<p>  \u042f \u0445\u043e\u0447\u0443 \u0438\u043c\u0435\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c (\u043a\u043e\u043b\u0432\u043e \u0432\u0435\u0440\u0448\u0438\u043d)x(\u043a\u043e\u043b\u0432\u043e \u0432\u0435\u0440\u0448\u0438\u043d). \u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043c\u044b \u0441\u043e\u043b\u0432\u0435\u0440\u0443 \u0434\u0430\u0451\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/493\/c1c\/008\/493c1c008018df9bed4910321f29ff00.svg\" alt=\"$A$\" data-tex=\"inline\"><\/math>, \u0430 \u0443\u0436 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e04\/579\/566\/e04579566e26ea6fa8fc62af6df240e4.svg\" alt=\"$A^\\top A$\" data-tex=\"inline\"><\/math> \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0430\u043c, \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e! \u0422\u0430\u043a\u0436\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044f \u0440\u0435\u0448\u0430\u044e \u043d\u0435 \u043e\u0434\u043d\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u0430 \u0442\u0440\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f x,y \u0438 z (\u044f \u0441\u043e\u0432\u0440\u0430\u043b, \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u0430\u044f, \u043e\u043d\u0430 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u0430\u044f!)<\/p>\n<p>  \u0410 \u0437\u0430\u0442\u0435\u043c \u044f \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u043d\u0430\u0448\u0435\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e \u0432\u0435\u0440\u0448\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u043d\u0430 \u043a\u0440\u0430\u044e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">        for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ fix the boundary vertices             if (m.opp(i)!=-1) continue;             int v = m.from(i);             nlRowScaling(100.);             nlBegin(NL_ROW);             nlCoefficient(v,  1);             nlRightHandSide(m.point(v)[d]);             nlEnd(NL_ROW);         } <\/code><\/pre>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u0448\u0442\u0440\u0430\u0444 \u0432 100^2 \u0434\u043b\u044f \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0440\u0430\u0435\u0432\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d.<\/p>\n<p>  \u041d\u0443 \u0430 \u0437\u0430\u0442\u0435\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u044b \u0441\u043c\u0435\u0436\u043d\u044b\u0445 \u0432\u0435\u0440\u0448\u0438\u043d \u044f \u0432\u0435\u0448\u0430\u044e \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0443 \u0436\u0451\u0441\u0442\u043a\u043e\u0441\u0442\u0438 1 \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438:<\/p>\n<pre><code class=\"cpp\">        for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ smooth the interior             if (m.opp(i)==-1) continue;             int v1 = m.from(i);             int v2 = m.to(i);              nlRowScaling(1.);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlEnd(NL_ROW);         } <\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u0434 \u0438 \u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u043b\u0438\u0446\u043e \u0441\u0433\u043b\u0430\u0434\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043c\u044b\u043b\u044c\u043d\u043e\u0439 \u043f\u043b\u0451\u043d\u043a\u0438 \u043d\u0430 \u0438\u0437\u043e\u0433\u043d\u0443\u0442\u043e\u0439 \u043f\u0440\u043e\u0432\u043e\u043b\u043e\u043a\u0435. \u041c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0440\u0435\u0448\u0438\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0414\u0438\u0440\u0438\u0445\u043b\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043b\u043e\u0449\u0430\u0434\u0438.<\/p>\n<h3>\u0423\u0441\u0438\u043b\u044f\u0435\u043c \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0447\u0435\u0440\u0442\u044b<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u043d\u0430\u0448\u0435 \u043b\u0438\u0446\u043e \u0432 \u0433\u0440\u043e\u0442\u0435\u0441\u043a\u043d\u0443\u044e \u043c\u0430\u0441\u043a\u0443:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/2d5\/dbf\/891\/2d5dbf89186c0a9008c15b714235ba19.jpg\"><\/p>\n<p>  \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0443\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435, \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u044f \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u043a\u043e\u0434, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0441\u043e\u043b\u0432\u0435\u0440 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">    for (int d=0; d&lt;3; d++) { \/\/ solve for x, y and z separately         nlNewContext();         nlSolverParameteri(NL_NB_VARIABLES, m.nverts());         nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);         nlBegin(NL_SYSTEM);         nlBegin(NL_MATRIX);          for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ fix the boundary vertices             if (m.opp(i)!=-1) continue;             int v = m.from(i);             nlRowScaling(100.);             nlBegin(NL_ROW);             nlCoefficient(v,  1);             nlRightHandSide(m.point(v)[d]);             nlEnd(NL_ROW);         }         for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ light attachment to the original geometry             if (m.opp(i)==-1) continue;             int v1 = m.from(i);             int v2 = m.to(i);              nlRowScaling(.2);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlRightHandSide(m.point(v1)[d] - m.point(v2)[d]);             nlEnd(NL_ROW);         }          for (int v=0; v&lt;m.nverts(); v++) { \/\/ amplify the curvature             nlRowScaling(1.);             nlBegin(NL_ROW);             int nneigh = m.incident_halfedges(v).size();             nlCoefficient(v,  nneigh);             Vec3f curvature = m.point(v)*nneigh;             for (int hid : m.incident_halfedges(v)) {                 nlCoefficient(m.to(hid),  -1);                 curvature = curvature - m.point(m.to(hid));             }             nlRightHandSide(2.5*curvature[d]);             nlEnd(NL_ROW);         }          nlEnd(NL_MATRIX);         nlEnd(NL_SYSTEM);         nlSolve();          for (int i=0; i&lt;m.nverts(); i++) {             m.point(i)[d] = nlGetVariable(i);         }     } <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 <a href=\"https:\/\/github.com\/ssloy\/least-squares-course\/tree\/e19236b7aadf6d544979e50a1c2cd03e0ee00fb2\/caricature\">\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u0443\u0442<\/a>. \u041a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041a\u0430\u043a \u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e \u043a\u0440\u0430\u0435\u0432\u044b\u0435 \u0432\u0435\u0440\u0448\u0438\u043d\u044b. \u0417\u0430\u0442\u0435\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0431\u0440\u0430 \u044f (\u0442\u0438\u0445\u043e\u043d\u0435\u0447\u043a\u043e, \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c 0.2) \u0433\u043e\u0432\u043e\u0440\u044e, \u0447\u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0431\u044b\u043b\u043e \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0438\u043c\u0435\u043b\u043e \u0440\u043e\u0432\u043d\u043e \u0442\u0443 \u0436\u0435 \u0444\u043e\u0440\u043c\u0443, \u0447\u0442\u043e \u0438 \u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">        for (int i=0; i&lt;m.nhalfedges(); i++) { \/\/ light attachment to the original geometry             if (m.opp(i)==-1) continue;             int v1 = m.from(i);             int v2 = m.to(i);              nlRowScaling(.2);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlRightHandSide(m.point(v1)[d] - m.point(v2)[d]);             nlEnd(NL_ROW);         } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c, \u0438 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043f\u0440\u044f\u043c\u043e \u043a\u0430\u043a \u0435\u0441\u0442\u044c, \u0442\u043e \u043c\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u043e\u0432\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0430 \u0432\u0445\u043e\u0434\u0435: \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u0445\u043e\u0434\u0430, \u043f\u043b\u044e\u0441 \u043f\u0435\u0440\u0435\u043f\u0430\u0434\u044b \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0440\u0430\u0432\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043f\u0430\u0434\u0430\u043c \u043d\u0430 \u0432\u0445\u043e\u0434\u0435. <\/p>\n<p>  \u041d\u043e \u043c\u044b \u043d\u0430 \u044d\u0442\u043e\u043c \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0435\u043c\u0441\u044f!<\/p>\n<pre><code class=\"cpp\">        for (int v=0; v&lt;m.nverts(); v++) { \/\/ amplify the curvature             nlRowScaling(1.);             nlBegin(NL_ROW);             int nneigh = m.incident_halfedges(v).size();             nlCoefficient(v,  nneigh);             Vec3f curvature = m.point(v)*nneigh;             for (int hid : m.incident_halfedges(v)) {                 nlCoefficient(m.to(hid),  -1);                 curvature = curvature - m.point(m.to(hid));             }             nlRightHandSide(2.5*curvature[d]);             nlEnd(NL_ROW);         } <\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0435\u0449\u0451 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u044f \u0441\u0447\u0438\u0442\u0430\u044e \u043a\u0440\u0438\u0432\u0438\u0437\u043d\u0443 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0432\u043e\u043a\u0440\u0443\u0433 \u043d\u0435\u0451 \u0432\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u044e \u0435\u0451 \u043d\u0430 \u0434\u0432\u0430 \u0441 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c, \u0432\u044b\u0445\u043e\u0434\u043d\u0430\u044f \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043a\u0440\u0438\u0432\u0438\u0437\u043d\u0443 \u043f\u043e\u0432\u0441\u044e\u0434\u0443.<\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0440\u0435\u0448\u0430\u0442\u0435\u043b\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043f\u043b\u043e\u0445\u0443\u044e \u043a\u0430\u0440\u0438\u043a\u0430\u0442\u0443\u0440\u0443.<\/p>\n<h3>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f<\/h3>\n<p>  \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043c\u044b \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432\u0441\u0451 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043c\u0435\u043d\u0435\u0435 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0435 \u0441\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043b\u0435\u0433\u043a\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043e\u043b\u0432\u0435\u0440\u043e\u0432. \u041a\u043e\u0434 <a href=\"https:\/\/github.com\/ssloy\/least-squares-course\/tree\/e19236b7aadf6d544979e50a1c2cd03e0ee00fb2\/cubify\">\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u0443\u0442<\/a>, \u043d\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043b\u0438\u0441\u0442\u0438\u043d\u0433:<\/p>\n<pre><code class=\"cpp\">#include &lt;vector&gt; #include &lt;iostream&gt;  #include \"OpenNL_psm.h\" #include \"geometry.h\" #include \"model.h\"  const Vec3f axes[] = {Vec3f(1,0,0), Vec3f(-1,0,0), Vec3f(0,1,0), Vec3f(0,-1,0), Vec3f(0,0,1), Vec3f(0,0,-1)}; int snap(Vec3f n) { \/\/ returns the coordinate axis closest to the given normal     double nmin = -2.0;     int    imin = -1;     for (int i=0; i&lt;6; i++) {         double t = n*axes[i];         if (t&gt;nmin) {             nmin = t;             imin = i;         }     }     return imin; }  int main(int argc, char** argv) {     if (argc&lt;2) {         std::cerr &lt;&lt; \"Usage: \" &lt;&lt; argv[0] &lt;&lt; \" obj\/model.obj\" &lt;&lt; std::endl;         return 1;     }      Model m(argv[1]);      std::vector&lt;int&gt; nearest_axis(m.nfaces());     for (int i=0; i&lt;m.nfaces(); i++) {         Vec3f v[3];         for (int j=0; j&lt;3; j++) v[j] = m.point(m.vert(i, j));         Vec3f n = cross(v[1]-v[0], v[2]-v[0]).normalize();         nearest_axis[i] = snap(n);     }      for (int d=0; d&lt;3; d++) { \/\/ solve for x, y and z separately         nlNewContext();         nlSolverParameteri(NL_NB_VARIABLES, m.nverts());         nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE);         nlBegin(NL_SYSTEM);         nlBegin(NL_MATRIX);          for (int i=0; i&lt;m.nhalfedges(); i++) {             int v1 = m.from(i);             int v2 = m.to(i);              nlRowScaling(1.);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlRightHandSide(m.point(v1)[d] - m.point(v2)[d]);             nlEnd(NL_ROW);              int axis = nearest_axis[i\/3]\/2;             if (d!=axis) continue;              nlRowScaling(2.);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlEnd(NL_ROW);         }          nlEnd(NL_MATRIX);         nlEnd(NL_SYSTEM);         nlSolve();          for (int i=0; i&lt;m.nverts(); i++) {             m.point(i)[d] = nlGetVariable(i);         }     }      std::cout &lt;&lt; m;     return 0; } <\/code><\/pre>\n<p>  \u041c\u044b \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e, \u0447\u0442\u043e \u0438 \u0440\u0430\u043d\u044c\u0448\u0435; \u043c\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e snap() \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u043a \u043a\u0430\u043a\u043e\u0439 \u043e\u0441\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0431\u043b\u0438\u0436\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u044c \u044d\u0442\u043e\u0433\u043e \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430. \u0422\u043e \u0435\u0441\u0442\u044c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u043d\u0430\u0442\u044c, \u044d\u0442\u043e\u0442 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0435\u043d \u0438\u043b\u0438 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0435\u043d. \u041d\u0443 \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044e \u043d\u0430\u0448\u0435\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u0442\u043e, \u0447\u0442\u043e \u0431\u043b\u0438\u0437\u043a\u043e \u043a \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u0438, \u0441\u0442\u0430\u043b\u043e \u0435\u0449\u0451 \u0431\u043b\u0438\u0436\u0435! \u041b\u0435\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u043e\u0442 \u044d\u0442\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 snap():<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/922\/108\/b9e\/922108b9e1ad284d0490ad3e50d090d6.jpg\"><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043c\u044b \u0440\u0430\u0441\u043a\u0440\u0430\u0441\u0438\u043b\u0438 \u043d\u0430\u0448\u0443 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c \u0432 \u0442\u0440\u0438 \u0446\u0432\u0435\u0442\u0430, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0440\u0451\u043c \u043e\u0441\u044f\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442. \u041d\u0443 \u0430 \u0437\u0430\u0442\u0435\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0435\u0431\u0440\u0430 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"cpp\">            nlRowScaling(1.);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlRightHandSide(m.point(v1)[d] - m.point(v2)[d]);             nlEnd(NL_ROW); <\/code><\/pre>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c, \u043c\u044b \u043f\u0440\u0435\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0440\u0435\u0431\u0440\u0443 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0440\u0435\u0431\u0440\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u0436\u0451\u0441\u0442\u043a\u043e\u0441\u0442\u044c \u043f\u0440\u0443\u0436\u0438\u043d\u043a\u0438 1. \u0410 \u0437\u0430\u0442\u0435\u043c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c x, \u0430 \u0440\u0435\u0431\u0440\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u0434\u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441 \u0436\u0451\u0441\u0442\u043a\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0443\u0436\u0438\u043d\u044b 2:<\/p>\n<pre><code class=\"cpp\">            nlRowScaling(2.);             nlBegin(NL_ROW);             nlCoefficient(v1,  1);             nlCoefficient(v2, -1);             nlEnd(NL_ROW); <\/code><\/pre>\n<p>  \u041d\u0443 \u0430 \u0432\u043e\u0442 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f48\/99d\/7c3\/f4899d7c3e2a6efed733108f90965c59.jpg\"><\/p>\n<p>  \u0412\u043f\u043e\u043b\u043d\u0435 \u0440\u0435\u0437\u043e\u043d\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441: \u0438\u0441\u0442\u0443\u043a\u0430\u043d\u044b \u0441 \u043e\u0441\u0442\u0440\u043e\u0432\u0430 \u041f\u0430\u0441\u0445\u0438, \u044d\u0442\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043a\u0440\u0443\u0442\u043e, \u043d\u043e \u043f\u0440\u0438 \u0447\u0451\u043c \u0442\u0443\u0442 \u0433\u0435\u043e\u043b\u043e\u0433\u0438\u044f? \u0415\u0441\u0442\u044c \u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447?<\/p>\n<p>  \u0414\u0430, \u043a\u043e\u043d\u0435\u0447\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043e\u0434\u0438\u043d \u0441\u0440\u0435\u0437 \u0437\u0435\u043c\u043d\u043e\u0439 \u043a\u043e\u0440\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7cf\/a27\/7c3\/7cfa277c343eed1d1410361fd211d71b.jpg\"><\/p>\n<p>  \u0414\u043b\u044f \u0433\u0435\u043e\u043b\u043e\u0433\u043e\u0432 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u044b \u0441\u043b\u043e\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u0440\u043e\u0434, \u0433\u0440\u0430\u043d\u0438\u0446\u044b (\u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u044b) \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u0437\u0435\u043b\u0451\u043d\u044b\u043c, \u0438 \u0433\u0435\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0440\u0430\u0437\u043b\u043e\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u044b \u043a\u0440\u0430\u0441\u043d\u044b\u043c. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0435\u0442\u043a\u0430 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432 (\u0442\u0435\u0442\u0440\u0430\u044d\u0434\u0440\u043e\u0432 \u0432 3\u0434) \u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442, \u043d\u043e \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u043a\u0432\u0430\u0434\u044b (\u0433\u0435\u043a\u0441\u0430\u044d\u0434\u0440\u044b \u0432 3\u0434). \u041c\u044b \u0434\u0435\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043b\u043e\u043c\u044b \u0441\u0442\u0430\u043b\u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438, \u0430 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u044b (\u0441\u044e\u0440\u043f\u0440\u0438\u0437) \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/614\/ce7\/b79\/614ce7b7970ab82ad59c43f850db118c.jpg\"><\/p>\n<p>  \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432, \u043d\u0430\u0440\u0435\u0436\u0435\u043c \u043d\u0430\u0448 \u0434\u043e\u043c\u0435\u043d \u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u044b\u0435 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a\u0438, \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u043d\u0438\u043c \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u043a\u0432\u0430\u0434\u043e\u0432.<\/p>\n<h1>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  \u041c\u0435\u0442\u043e\u0434\u044b \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0445 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u2014 \u043c\u043e\u0449\u043d\u0435\u0439\u0448\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0448\u0438\u0440\u0435, \u043d\u0435\u0436\u0435\u043b\u0438 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 \u0432 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u0445 \u044d\u043a\u0441\u0435\u043b\u044f. \u042d\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435, \u0430 \u0440\u0435\u0448\u0430\u0442\u044c \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043c\u044b (\u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u0442\u0432\u043e) \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043e\u0447\u0435\u043d\u044c \u0438 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0434\u0430\u0436\u0435 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u0432 \u0441 \u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u043d\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0445\u0432\u0430\u0442\u0438\u0442\u044c. \u0418 \u0442\u0443\u0442 \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0439\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u041c\u041d\u041a \u0441 \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043e\u043a \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439. \u041e\u0441\u0442\u0430\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u043b\u0438\u043d\u0438\u0438!<\/p><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <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\/post\/477192\/\"> https:\/\/habr.com\/ru\/post\/477192\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/477192\/\">\u041f\u0440\u043e\u0434\u043b\u043e\u0436\u0430\u044e \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044e \u0441\u0432\u043e\u0438\u0445 \u043b\u0435\u043a\u0446\u0438\u0439, \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432, \u0443\u0447\u0430\u0449\u0438\u0445\u0441\u044f \u043f\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00ab\u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u0433\u0435\u043e\u043b\u043e\u0433\u0438\u044f\u00bb. \u041d\u0430 \u0445\u0430\u0431\u0440\u0435 \u044d\u0442\u043e \u0443\u0436\u0435 \u0442\u0440\u0435\u0442\u044c\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u0432\u0432\u043e\u0434\u043d\u043e\u0439, \u043e\u043d\u0430 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430 \u043a \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044e. \u041e\u0434\u043d\u0430\u043a\u043e \u0436\u0435 \u0434\u043b\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/429980\/\">\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/a> \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0434\u0430\u0436\u0435 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u0431\u0443\u0434\u0443 \u043c\u043d\u043e\u0433\u043e \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f: \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0443\u043c\u0435\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u044e \u0433\u043e\u043b\u043e\u0432\u0443 \u0432 \u0438\u0441\u0442\u0443\u043a\u0430\u043d\u0430 \u0441 \u043e\u0441\u0442\u0440\u043e\u0432\u0430 \u041f\u0430\u0441\u0445\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f48\/99d\/7c3\/f4899d7c3e2a6efed733108f90965c59.jpg\">  <\/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-295112","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295112","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=295112"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/295112\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=295112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=295112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=295112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}