{"id":287731,"date":"2018-08-16T14:15:32","date_gmt":"2018-08-16T10:15:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=287731"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=287731","title":{"rendered":"\u0427\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/418981\/\" class=\"post__text post__text-html js-mediator-article\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430. <br \/>   \u041a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0442\u0432\u0435\u0440\u0434\u043e\u043c \u0442\u0435\u043b\u0435, \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0438\u0444\u0444\u0443\u0437\u0438\u0438, \u0437\u0430\u0434\u0430\u0447\u0438 \u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u043d\u0435\u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0440\u044f\u0434\u043e\u0432 \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u00ad\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0433\u043e\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 [1]<\/p>\n<p>  <b>\u0426\u0435\u043b\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/b> \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430 \u0434\u043b\u044f \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u0438 \u041d\u0435\u0439\u043c\u0430\u043d\u0430, \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u0423\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f\u043c \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438 \u0432 \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434 [1]:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/3d\/gu\/a8\/3dgua8aaenup1nhwe6d3mgwc0og.png\"> (1)<\/p>\n<p>  \u0433\u0434\u0435 x \u2013 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430; u(x) \u2013 \u0438\u0441\u043a\u043e\u043c\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f; A(x), f(x) \u2013 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. <\/p>\n<p>  \u0420\u0435\u0448\u0438\u043c \u043e\u0434\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f \u0410 = 1, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/i9\/zo\/ye\/i9zoyeml4g56q9culr1maeltexw.png\"> (2)<\/p>\n<p>  \u0417\u0430\u0434\u0430\u0434\u0438\u043c \u043d\u0430 \u043e\u0442\u0440\u0435\u0437\u043a\u0435 [xmin, xmax] \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u0443\u044e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u0443\u044e \u0441\u0435\u0442\u043a\u0443 \u0441 \u0448\u0430\u0433\u043e\u043c \u2206\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sz\/l7\/nc\/szl7ncea-n2cb6qpgpooef9rrlc.png\"> (3)<\/p>\n<p>  \u0413\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u043e\u0434\u0430 (\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0414\u0438\u0440\u0438\u0445\u043b\u0435) \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u00ad\u043c\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wz\/d1\/oh\/wzd1ohqzrvar1rxwzbpuzvskgas.png\"> (4)<\/p>\n<p>  \u0433\u0434\u0435 \u04451, xn \u2013 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043e\u0431\u043b\u0430\u0441\u0442\u0438 [xmin, xmax]; g1, g2 \u2013 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435<br \/>  \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b.<\/p>\n<p>  \u0413\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0440\u043e\u0434\u0430 (\u0443\u0441\u043b\u043e\u0432\u0438\u044f \u041d\u0435\u0439\u043c\u0430\u043d\u0430) \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u00ad\u043c\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0432\u0438\u0434\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/v7\/e_\/js\/v7e_jsncffbgg7oj0qgcfxhkoq8.png\"> (5)<\/p>\n<p>  \u041f\u0440\u043e\u0432\u043e\u0434\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0435 (3) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u043e\u00ad\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ql\/z7\/rh\/qlz7rh-dairli3upqpepucctqq8.png\"> (6)<\/p>\n<p>  \u0433\u0434\u0435 u1, un \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 u(x) \u0432 \u0442\u043e\u0447\u043a\u0430\u0445 x1, xn \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  \u041f\u0440\u043e\u0432\u043e\u0434\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u041d\u0435\u0439\u043c\u0430\u043d\u0430 \u043d\u0430 \u0441\u0435\u0442\u043a\u0435 (3), \u043f\u043e\u00ad\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/wb\/ia\/ab\/wbiaabrixia416dswku9qdrb0ew.png\"> (7)<\/p>\n<p>  \u041f\u0440\u043e\u0432\u043e\u0434\u044f \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (2) \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u0441\u0435\u0442\u043a\u0438, \u043f\u043e\u00ad\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lb\/x9\/1o\/lbx91o4els8rbssi999ixiup3hq.png\"> (8)<\/p>\n<p>  \u0433\u0434\u0435 ui, fi \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 u(x), f(x) \u0432 \u0442\u043e\u0447\u043a\u0435 \u0441\u0435\u0442\u043a\u0438 \u0441 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043e\u0439 xi.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e n, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e n \u2013 2 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0430 (8) \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 \u0442\u043e\u0447\u0435\u043a \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (6) \u0438 (7) \u0434\u043b\u044f \u0434\u0432\u0443\u0445 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0442\u043e\u0447\u0435\u043a [1].<\/p>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043d\u0430 Python \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f (2) \u0441 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u043c\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 (4) \u2013 (5) \u043d\u0430 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0435 (3).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from numpy import* from numpy.linalg import solve import matplotlib.pyplot as plt x0=0#\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f xn=5#\u041a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f n=100#\u0427\u0438\u0441\u043b\u043e \u0442\u043e\u0447\u0435\u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438 dx=(xn-x0)\/(n-1)#\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438 \u0441 \u0448\u0430\u0433\u043e\u043c dx x=[i*dx+x0 for i in arange(0,n,1)]#\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438 \u0441 \u0448\u0430\u0433\u043e\u043c dx def f(i):#\u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f          return 2*sin(x[i]**2)+cos(x[i]**2) v1=1.0#\u0412\u0438\u0434 \u0413\u0423 \u043d\u0430 \u043b\u0435\u0432\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 (1 - \u0414\u0438\u0440\u0438\u0445\u043b\u0435, 2 - \u041d\u0435\u0439\u043c\u0430\u043d\u0430) g1=0.0#\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0413\u0423 \u043d\u0430 \u043b\u0435\u0432\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 v2=2.0#'\u0412\u0438\u0434 \u0413\u0423 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 (1 - \u0414\u0438\u0440\u0438\u0445\u043b\u0435, 2 - \u041d\u0435\u0439\u043c\u0430\u043d\u0430) g2=-0.5#\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0413\u0423 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439 \u0433\u0440\u0430\u043d\u0438\u0446\u0435 a=zeros([n,n])#\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0421\u041b\u0410\u0423 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e n x n b=zeros([1,n])# \u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b-\u0441\u0442\u0440\u043e\u043a\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0447\u043b\u0435\u043d\u043e\u0432 \u0421\u041b\u0410\u0423 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e 1 x n  #\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0447\u043b\u0435\u043d\u043e\u0432 \u0421\u041b\u0410\u0423, # \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u0438 #\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 v1, v2 b[0,n-1]=g1; if v1==1:          a[0,0]=1 elif v1==2:          a[0,0]=-1\/dx          a[0,1]=1\/dx; else:          print('\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 v1 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435') b[0,n-1]=g2; if v2==1:          a[n-1,n-1]=1          elif v2==2:          a[n-1,n-1]=1\/dx          a[n-1,n-2]=-1\/dx; else:          print('\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 v2 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435') #\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u0432 \u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0447\u043b\u0435\u043d\u043e\u0432 \u0421\u041b\u0410\u0423, # \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c \u0442\u043e\u0447\u043a\u0430\u043c \u043e\u0431\u043b\u0430\u0441\u0442\u0438          for i in arange(1, n-1,1):          a[i,i]=-2\/dx**2          a[i,i+1]=1\/dx**2          a[i,i-1]=1\/dx**2          b[0,i]=f(i) u=linalg.solve(a,b.T).T#\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u0421\u041b\u0410\u0423 def viz(v1,v2):          if v1==v2==1:                   return \"\u0413\u0423  \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u043d\u0430 \u043b\u0435\u0432\u043e\u0439 \u0438 \u0413\u0423 \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439  \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \"          elif v1==1 and v2==2:                   return \"\u0413\u0423  \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u043d\u0430 \u043b\u0435\u0432\u043e\u0439 \u0438 \u0413\u0423 \u041d\u0435\u0439\u043c\u0430\u043d\u0430 \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439  \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \"          elif v2==1 and v2==1:                   return \"\u0413\u0423  \u041d\u0435\u0439\u043c\u0430\u043d\u0430 \u043d\u0430 \u043b\u0435\u0432\u043e\u0439 \u0438 \u0413\u0423 \u0414\u0438\u0440\u0438\u0445\u043b\u0435  \u043d\u0430 \u043f\u0440\u0430\u0432\u043e\u0439  \u0433\u0440\u0430\u043d\u0438\u0446\u0435 \" plt.figure() plt.title(\"\u0413\u0440\u0430\u0444\u0438\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430\") y=[f(i) for i in arange(0,n,1)] plt.plot(x,y) plt.grid(True) plt.xlabel('x') plt.ylabel('f(x)') plt.figure() plt.title(\"\u0413\u0440\u0430\u0444\u0438\u043a \u0438\u0441\u043a\u043e\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430\") plt.xlabel('x') plt.ylabel('u(x)') plt.plot(x,u[0,:],label='%s'%viz(v1,v2)) plt.legend(loc='best') plt.grid(True) plt.show()<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/rg\/cb\/sn\/rgcbsnh0xas1izeutmg48zpjoj4.png\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ev\/a3\/wn\/eva3wn1cnai0vctjeuphffruzds.png\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ie\/3g\/sq\/ie3gsqcgut9b9oaou1p1wlziduu.png\"><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/px\/4d\/sd\/px4dsds2c4l1cpvzt3xfo9magvk.png\"><\/p>\n<p>  \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u043c\u043d\u043e\u044e \u043d\u0430 Python \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0443\u0434\u043e\u0431\u043d\u0430 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439.\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 Python \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e Numpy \u2014 u=linalg.solve(a,b.T).T \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439, \u0447\u0442\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u0438 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 {a}. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0440\u043e\u0441\u0442\u0435 \u0447\u0438\u0441\u043b\u0430 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0440\u0435\u0445 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438, \u0432\u043e\u0442 \u043d\u0430\u0448\u0451\u043b \u043d\u0430 \u0444\u043e\u0440\u0443\u043c\u0435 \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441 \u0442\u0440\u0451\u0445 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435\u0439<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from __future__ import print_function  from __future__ import division  import numpy as np  import time  ti = time.clock()  m = 1000  A = np.zeros((m, m))  B = np.zeros((m, 1))   A[0, 0] = 1  A[0, 1] = 2  B[0, 0] = 1  for i in range(1, m-1):      A[i, i-1] = 7      A[i, i] = 8       A[i, i+1] = 9      B[i, 0] = 2  A[m-1, m-2] = 3  A[m-1, m-1] = 4  B[m-1, 0] = 3  print('A \\n', A)  print('B \\n', B)  x = np.linalg.solve(A, B)  # solve A*x = B for x  print('x \\n', x)  print('NUMPY time', time.clock()-ti, 'seconds') <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0439 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0441\u0435\u0442\u043a\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u0434\u043b\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u043a\u0446\u0438\u0438-\u0434\u0438\u0444\u0444\u0443\u0437\u0438\u0438<\/h3>\n<p> [2]<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/lw\/ok\/-w\/lwok-wgeshkjl9btqblywy2reoa.png\"> (9)<\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u043f\u043f\u0440\u043e\u043a\u0441\u0438\u043c\u0430\u0446\u0438\u0438 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0433\u043e \u0438 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438.\u0434\u043b\u044f \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 \u043f\u0440\u0438 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441 \/(\u0445) = 1 \u0438 6(\u0445) = 0,10. \u0412 \u0441\u0435\u0442\u043e\u0447\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/_h\/mi\/o5\/_hmio5lokrlapgkzphgkej3jv_a.png\"> (10)<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u0410 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0443\u043c\u043c\u044b \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0439, \u043d\u0438\u0436\u043d\u0435\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u0438 \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qk\/md\/ci\/qkmdcimjicx_yvmpzz_-i92cuuy.png\"> (10)<\/p>\n<p>  <b>\u041c\u0435\u0442\u043e\u0434 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<\/b>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/r4\/zz\/um\/r4zzum2ylgsk9813-24n1g_lvhg.png\"> (11)<\/p>\n<p>  \u041f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yu\/ht\/8m\/yuht8mbyk9lnpkeuaaohiyri6ls.png\">\\ \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043e \u0432\u0435\u0440\u0445\u043d\u0435\u0439 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438, \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/yk\/_r\/p3\/yk_rp384zddromi8jgnmmtw_ijy.png\"> \u2014 \u043e \u043d\u0438\u0436\u043d\u0435\u0439 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">from numpy import * \"\"\" \u0427\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u0434\u043b\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u043a\u0446\u0438\u0438-\u0434\u0438\u0444\u0444\u0443\u0437\u0438\u0438 \u0432 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0435.\u041c\u0435\u0442\u043e\u0434 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438.\"\"\" def relaxation(b, f, I1, I2, n1, n2, omega, tol = 1.e-8):          h1 = I1 \/ n1          h2 = I2 \/ n2          d = 2. \/ h1**2 + 2. \/ h2**2          y = zeros([n1+1, n2+1])          ff = zeros([n1+1, n2+1])          bb = zeros([n1+1, n2+1])          for j in arange(1,n2,1):                   for i in arange(1,n1,1):                            ff [i,j] = f(i*h1, j*h2)                            bb[i,j] = b(i*h1, j*h2)                                     #\u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 - 10000          for k in arange(1, 10001,1):                   rn = 0.                   for j in arange(1,n2,1):                            for i in arange(1,n1,1):                                                                         rr = - (y[i-1,j] - 2.*y [i, j] + y[i+1,j]) \/ h1**2 \\                                          - (y[i,j-1] - 2.*y [i,j] + y[i,j+1]) \/ h2**2 \\                                          + bb[i,j]*(y [i+1,j] - y [i-1,j]) \/ (2.*h1) - ff [i,j]                                                                         rn = rn + rr**2                                     y[i,j] = y[i,j] - omega * rr \/ d                   rn = rn*h1*h2                   if rn &lt; tol**2: return y, k                            print ('\u041c\u0435\u0442\u043e\u0434 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 \u043d\u0435 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f:')          print ('\u043f\u043e\u0441\u043b\u0435 10000 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a=',sqrt(rn)) import matplotlib.pyplot as plt bcList = [0., 10.] sglist = ['-','--'] kk = 0 for bc in bcList:                   I1 = 1.          I2 = 1.          def f(x,y):                   return 1.          def b(x,y):                                    return bc          n1 = 25          n2 = 25          m = 20          om = linspace(1., 1.95, m)          it = zeros(([m]))          for k in arange(0,m,1):                   omega = om[k]                   y, iter = relaxation(b, f, I1, I2, n1, n2, omega, tol=1.e-6)                   it[k] = iter          s1= 'b =' + str(bc)          sg = sglist[kk]          kk = kk+1          plt.plot( om,it, sg, label = s1) plt.title(\"\u0427\u0438\u0441\u043b\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438\\n \u0434\u043b\u044f \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0451\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438\\n \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 $\\\\omega$\") plt.xlabel('$\\\\omega$') plt.ylabel('iterations') plt.legend(loc=0) plt.grid(True) plt.show(<\/code><\/pre>\n<p>)  <\/div>\n<\/div>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uw\/l5\/ke\/uwl5kestbhuztbnsnmh8joy8o2m.png\"><\/p>\n<p>  \u041d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430 (b(\u0445) = 0) \u0438 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u043a\u0446\u0438\u0438-\u0434\u0438\u0444\u0444\u0443\u0437\u0438\u0438 (b(\u0445) = 10). \u0414\u043b\u044f \u0441\u0435\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hy\/tq\/bz\/hytqbzpded7xzlvqkdhxjdnhr_w.png\">.<\/p>\n<p>  \u0412\u044b\u0432\u043e\u0434\u044b: <\/p>\n<ol>\n<li>\u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430 Python \u0441 \u0433\u0438\u0431\u043a\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439<\/li>\n<li>\u041f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438 \u0438\u043c\u0435\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d (<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hy\/tq\/bz\/hytqbzpded7xzlvqkdhxjdnhr_w.png\">) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u0438.<\/li>\n<\/ol>\n<p>  \u0421\u0441\u044b\u043b\u043a\u0438:<\/p>\n<ol>\n<li>\u0420\u044b\u043d\u0434\u0438\u043d \u0415.\u0410. \u041c\u0435\u0442\u043e\u0434\u044b \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0438. \u2013 \u0422\u0430\u0433\u0430\u043d\u0440\u043e\u0433:<br \/>   \u0418\u0437\u0434-\u0432\u043e \u0422\u0420\u0422\u0423, 2003. \u2013 120 \u0441.<\/li>\n<li>\u0412\u0430\u0431\u0438\u0449\u0435\u0432\u0438\u0447 \u041f.\u041d.\u0427\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b: \u0412\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0443\u043c. \u2014 \u041c.: \u041a\u043d\u0438\u0436\u043d\u044b\u0439 \u0434\u043e\u043c<br \/>   \u00ab\u041b\u0418\u0411\u0420\u041e\u041a\u041e\u041c\u00bb, 2010. \u2014 320 \u0441.<\/li>\n<\/ol>\n<\/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\/post\/418981\/\"> https:\/\/habr.com\/post\/418981\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/418981\/\" class=\"post__text post__text-html js-mediator-article\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\u043c \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430. <br \/>   \u041a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u0434\u0430\u0447\u0438 \u043e \u0441\u0442\u0430\u0446\u0438\u043e\u043d\u0430\u0440\u043d\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0432 \u0442\u0432\u0435\u0440\u0434\u043e\u043c \u0442\u0435\u043b\u0435, \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u0438\u0444\u0444\u0443\u0437\u0438\u0438, \u0437\u0430\u0434\u0430\u0447\u0438 \u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0432 \u043d\u0435\u043f\u0440\u043e\u0432\u043e\u0434\u044f\u0449\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0437\u0430\u0440\u044f\u0434\u043e\u0432 \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u043b\u043b\u0438\u043f\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u0444\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0430\u043b\u0433\u0435\u0431\u0440\u0430\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0439. \u0422\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u00ad\u043b\u044f\u0435\u0442\u0441\u044f \u0448\u0430\u0433\u043e\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u0438, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0438 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0439 \u0441\u0435\u0442\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 [1]<\/p>\n<p>  <b>\u0426\u0435\u043b\u044c \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438<\/b> \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0443\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u041f\u0443\u0430\u0441\u0441\u043e\u043d\u0430 \u0434\u043b\u044f \u0433\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u0414\u0438\u0440\u0438\u0445\u043b\u0435 \u0438 \u041d\u0435\u0439\u043c\u0430\u043d\u0430, \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0440\u0435\u043b\u0430\u043a\u0441\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445.   <\/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-287731","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287731","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=287731"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/287731\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=287731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=287731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=287731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}