{"id":289824,"date":"2018-09-24T16:15:02","date_gmt":"2018-09-24T12:15:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=289824"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=289824","title":{"rendered":"\u0420\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0442\u043e\u0447\u043a\u0438 \u043f\u043e \u0441\u0444\u0435\u0440\u0435 \u0432 pytorch \u0438 tensorflow"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u042d\u0442\u043e\u0442 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a pytorch \u0438 tensorflow \u0434\u043b\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0443\u044e\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e numpy \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0410 \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PovRay \u0438 vapory. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kz\/fa\/h2\/kzfah2g6zgoehvsimumi8hy9nie.jpeg\"><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h3 id=\"otkuda-zadacha\">\u041e\u0442\u043a\u0443\u0434\u0430 \u0437\u0430\u0434\u0430\u0447\u0430<\/h3>\n<p>  <\/p>\n<blockquote><p>\u041a\u0430\u0436\u0434\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b (\u0441) \u0410\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u0439 \u0434\u0430\u0442\u0430-\u0441\u0430\u0439\u0435\u043d\u0442\u0438\u0441\u0442<\/p><\/blockquote>\n<p>\u0412 <a href=\"https:\/\/habr.com\/company\/hh\/blog\/415437\/\">\u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0439 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u043b\u043e\u0433\u0430<\/a>, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u043f\u0443\u043d\u043a\u0442\u0435 &#171;\u0413\u0440\u0430\u0431\u043b\u0438 \u21166&#187;, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u043b\u043e\u0441\u044c \u043e \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 DSSM, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u044b. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0442\u0430\u043a\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439, \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u0442\u0435\u0440\u044c. \u041f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438, \u0442\u044f\u0436\u0435\u043b\u043e \u0438\u0437-\u0437\u0430 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u0438 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0443\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. \u041f\u0443\u0441\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0442\u043e\u0433\u0434\u0430 \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c. \u0410 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u043c \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u0447\u0435\u043a \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0438 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f \u043a \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u0435. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a \u043f\u043e \u0441\u0444\u0435\u0440\u0435. \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043b\u0435\u0433\u043a\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0433\u043b\u0430\u0437.<\/p>\n<p>  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c <a href=\"http:\/\/mathworld.wolfram.com\/SpherePointPicking.html\" title=\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 mathworld\">\u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u0441\u0444\u0435\u0440\u0435<\/a> \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0442\u043e\u0447\u0435\u043a. <a href=\"https:\/\/en.wikibooks.org\/wiki\/Mathematica\/Uniform_Spherical_Distribution\" title=\"Wikibooks\">\u0422\u0430\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435<\/a> \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u0430\u043a\u0443\u0441\u0442\u0438\u043a\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u043a\u0430\u043a\u043e\u043c \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u043e\u043b\u043d\u0443 \u0432 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0435. \u0421\u0432\u044f\u0437\u0438\u0441\u0442\u0443 \u2014 \u0447\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u043e\u0440\u0431\u0438\u0442\u0435 \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0438 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0432\u044f\u0437\u0438. \u041c\u0435\u0442\u0435\u043e\u0440\u043e\u043b\u043e\u0433\u0443 \u2014 \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u043d\u0446\u0438\u0439 \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f \u0437\u0430 \u043f\u043e\u0433\u043e\u0434\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0437\u0430\u0434\u0430\u0447\u0430 <a href=\"https:\/\/stackoverflow.com\/questions\/14805583\/dispersing-n-points-uniformly-on-a-sphere\" title=\"\u041e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0441\u0442\u0435\u043a\u043e\u0432\u0435\u0440\u0444\u043b\u043e\u0443 \u0441 \u043f\u043b\u0430\u0442\u043e\u043d\u043e\u0432\u044b\u043c\u0438 \u0442\u0435\u043b\u0430\u043c\u0438\">\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043b\u0435\u0433\u043a\u043e<\/a>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/e14\/d0f\/193\/e14d0f19357a4b8b3dc59d240addb9ba.svg\" alt=\"$n=8$\" data-tex=\"inline\"><\/math>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u044f\u0442\u044c \u043a\u0443\u0431 \u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0431\u0443\u0434\u0443\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u043e\u043c \u043a \u0437\u0430\u0434\u0430\u0447\u0435. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u0432\u0435\u0437\u0451\u0442, \u0435\u0441\u043b\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0432\u0435\u0440\u0448\u0438\u043d \u0438\u043a\u043e\u0441\u0430\u044d\u0434\u0440\u0430, \u0434\u043e\u0434\u0435\u043a\u0430\u044d\u0434\u0440\u0430 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u043b\u0430\u0442\u043e\u043d\u043e\u0432\u0430 \u0442\u0435\u043b\u0430. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0435 \u0441\u0442\u043e\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0442\u043e\u0447\u0435\u043a \u0435\u0441\u0442\u044c <a href=\"https:\/\/www.ncbi.nlm.nih.gov\/pmc\/articles\/PMC3079956\/\" title=\"\u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u043f\u0438\u0440\u0430\u043b\u0438\">\u0444\u043e\u0440\u043c\u0443\u043b\u0430 \u0441 \u044d\u043c\u043f\u0438\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u0430\u043c\u0438<\/a>, \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u2014 <a href=\"https:\/\/www.ncbi.nlm.nih.gov\/pmc\/articles\/PMC3079956\/\" title=\"\u0415\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u043e \u0441\u043f\u0438\u0440\u0430\u043b\u044c\">\u0437\u0434\u0435\u0441\u044c<\/a>, <a href=\"http:\/\/corysimon.github.io\/articles\/uniformdistn-on-sphere\/\" title=\"\u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0430 \u043d\u0430 \u043d\u0435\u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\">\u0437\u0434\u0435\u0441\u044c<\/a>, <a href=\"https:\/\/en.wikibooks.org\/wiki\/Mathematica\/Uniform_Spherical_Distribution\" title=\"\u041d\u0430 \u0441\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430\">\u0437\u0434\u0435\u0441\u044c<\/a>, \u0438 <a href=\"https:\/\/www.fundamental-research.ru\/ru\/article\/view?id=31243\" title=\"\u0444\u0443\u043d\u0434\u0430\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041d\u043e \u0435\u0441\u0442\u044c \u0438 \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435, \u0445\u043e\u0442\u044f \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435 <a href=\"https:\/\/ru.stackoverflow.com\/questions\/205487\/%d0%a0%d0%b0%d0%b2%d0%bd%d0%be%d0%bc%d0%b5%d1%80%d0%bd%d0%be%d0%b5-%d1%80%d0%b0%d1%81%d0%bf%d1%80%d0%b5%d0%b4%d0%b5%d0%bb%d0%b5%d0%bd%d0%b8%d0%b5-%d1%82%d0%be%d1%87%d0%b5%d0%ba-%d0%bd%d0%b0-%d1%81%d1%84%d0%b5%d1%80%d0%b5\" title=\"\u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0441\u0442\u044d\u043a\u043e\u0432\u0435\u0440\u0444\u043b\u043e\u0443\">\u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u0448\u0438\u043c \u0437\u0430\u0434\u0430\u0447\u0443, \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0443\u044e \u043d\u0430 <a href=\"http:\/\/www.etudes.ru\/ru\/etudes\/thomson-problem\/\" title=\"\u0417\u0430\u0434\u0430\u0447\u0430 \u0422\u043e\u043c\u0441\u043e\u043d\u0430 \u043d\u0430 \u044d\u0442\u044e\u0434\u0430\u0445\">\u0437\u0430\u0434\u0430\u0447\u0443 \u0422\u043e\u043c\u0441\u043e\u043d\u0430<\/a> (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Thomson_problem\" title=\"\u0417\u0430\u0434\u0430\u0447\u0430 \u0422\u043e\u043c\u0441\u043e\u043d\u0430 \u043d\u0430 \u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438\">wiki<\/a>). \u0420\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u0435\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0442\u043e\u0447\u0435\u043a \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e, \u0430 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043c \u0438\u0445 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043a \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a \u0441\u0444\u0435\u0440\u0435, \u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u2014 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u043e\u043c. \u041f\u0440\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u043e\u0447\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u043d\u0430 \u0441\u0444\u0435\u0440\u0435 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e. <\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 machine learning (ML), \u0432 \u0445\u043e\u0434\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c. \u041d\u043e \u0434\u0430\u0442\u0430-\u0441\u0430\u0439\u0435\u043d\u0442\u0438\u0441\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u0441\u043c\u043e\u0442\u0440\u0438\u0442, \u043a\u0430\u043a \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u0430 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0437\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438. \u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0432\u0441\u0451 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u0442\u043e\u0447\u043a\u0438, \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0451\u043d\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u0443\u0431\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 1, \u0440\u0430\u0437\u043e\u0439\u0434\u0443\u0442\u0441\u044f \u043f\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0441\u0444\u0435\u0440\u044b:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/52\/sl\/vj\/52slvj5tsk6xdd-d1ymry_lty1i.png\"><\/p>\n<p>  <\/p>\n<p>\u0421\u0445\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0435, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u0432 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u044b $X$. \u041f\u043e \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c $L$, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a \u043f\u043e \u0441\u0444\u0435\u0440\u0435. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a <code>pytorch<\/code> \u0438 <code>tensorflow<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044c \u043f\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0435 $X$ \u0438 \u0441\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043e\u0434\u0438\u043d \u0438\u0437 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432: SGD, ADAM, ADAGRAD \u0438 \u0442.\u0434.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/aq\/ol\/q_\/aqolq_qbiybgyykwurj9dzap1nw.png\"><\/p>\n<p>  <\/p>\n<h3 id=\"schitaem-potencial\">\u0421\u0447\u0438\u0442\u0430\u0435\u043c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b<\/h3>\n<p>  <\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435, \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u043a \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445, Python \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 Python. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0431\u044b\u0441\u0442\u0440\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0445 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 numpy. \u0414\u043b\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u2014 pytorch \u0438 tensorflow.<\/p>\n<p>  <\/p>\n<p>\u0421\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0440\u0430\u0437\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u0447\u043a\u0438 \u0432 \u043a\u0443\u0431\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043e\u0439 1. \u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 500 \u0442\u043e\u0447\u0435\u043a, \u0430 \u0443\u043f\u0440\u0443\u0433\u043e\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0432 1000 \u0440\u0430\u0437 \u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0438\u043c\u043e, \u0447\u0435\u043c \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import numpy as np  n = 500 k = 1000 X = np.random.rand(n, 3)<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6d6\/a4f\/78f\/6d6a4f78fbacd6edecc018ce8ad3e364.svg\" alt=\"$X$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ef\/4cf\/16e\/6ef4cf16e1ed3244f80b47ca4c3fe73a.svg\" alt=\"$3\\times n$\" data-tex=\"inline\"><\/math>, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u0443\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u043c\u0438 \u0447\u0438\u0441\u043b\u0430\u043c\u0438 \u043e\u0442 0 \u0434\u043e 1:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vn\/vf\/s-\/vnvfs-cf0qee5vhmzn3vwidsn64.png\"><\/p>\n<p>  <\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u044d\u0442\u043e\u0439 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0435. \u0410 \u0432 \u0442\u0440\u0451\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9f7\/7b6\/138\/9f77b6138a29c08ab41140e6a5391504.svg\" alt=\"$x, y, z$\" data-tex=\"inline\"><\/math> \u0432\u0441\u0435\u0445 \u043d\u0430\u0448\u0438\u0445 \u0442\u043e\u0447\u0435\u043a.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0443\u043f\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u0447\u043a\u0438 \u0441 \u043f\u043e\u0432\u0435\u0445\u043d\u043e\u0441\u0442\u044c\u044e \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6ae\/808\/d7d\/6ae808d7d4b10d1599171bc569cb4dd1.svg\" alt=\"$u_1 = k \\cdot (1 - r)^2 \/ 2$\" data-tex=\"inline\"><\/math>. \u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u0447\u0435\u043a <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/839\/f25\/c27\/839f25c2746382debd4f08ea25ad5ecf.svg\" alt=\"$p$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d68\/cc4\/926\/d68cc4926bf74bae8fa3b51ca4a09ec8.svg\" alt=\"$q$\" data-tex=\"inline\"><\/math> \u2014 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/25b\/2d4\/32f\/25b2d432f6e572db878249199aff4ed4.svg\" alt=\"$u_2 = 1 \/ |r_p - r_q| $\" data-tex=\"inline\"><\/math>. \u041f\u043e\u043b\u043d\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0430\u0440 \u0442\u043e\u0447\u0435\u043a \u0438 \u0443\u043f\u0440\u0443\u0433\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0441 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0444\u0435\u0440\u044b:<\/p>\n<p>  <\/p>\n<p><math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/033\/ab8\/e51\/033ab8e51afb134f0c9cd367a581a462.svg\" alt=\"$U(x_1, ..., x_n) = \\sum \\limits _{p = 1} ^{n - 1} \\sum \\limits _ {q = p + 1} ^ {n} \\frac 1 { \\left | \\vec{x_p} - \\vec {x_q} \\right | } + k \\cdot \\sum \\limits _ {p = 1} ^ n \\left ( 1 - |\\vec {x_p}| \\right ) ^2 \\rightarrow \\min$\" data-tex=\"display\"><\/math><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u0430 \u043f\u043e \u044d\u0442\u043e\u0439 \u0444\u043e\u0440\u043c\u0443\u043b\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">L_for = 0 L_for_inv = 0 L_for_sq = 0 for p in range(n):     p_distance = 0     for i in range(3):         p_distance += x[p, i]**2     p_distance = math.sqrt(p_distance)     L_for_sq += k * (1 - p_distance)**2  # \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u0442 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0441\u0444\u0435\u0440\u044b, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443 \u0443\u043f\u0440\u0443\u0433\u043e\u0441\u0442\u0438     for q in range(p + 1, n):         if q != p:             pq_distance = 0             for i in range(3):                 pq_distance += (x[p, i] - x[q, i]) ** 2             pq_distance = math.sqrt(pq_distance)             L_for_inv += 1 \/ pq_distance  # \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0442\u043e\u0447\u043a\u0430\u043c\u0438 L_for = (L_for_inv + L_for_sq) \/ n print('loss =', L_for)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u043e \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0431\u0435\u0434\u0430. \u0414\u043b\u044f \u0436\u0430\u043b\u043a\u0438\u0445 2000 \u0442\u043e\u0447\u0435\u043a \u044d\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c 2 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0413\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u044d\u0442\u0443 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0423\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0437\u0430 \u0441\u0447\u0451\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e &#171;\u0431\u044b\u0441\u0442\u0440\u044b\u0445&#187; \u044f\u0437\u044b\u043a\u043e\u0432 fortran \u0438 C, \u0442\u0430\u043a \u0438 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0445 \u0437\u0430 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0434 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/da6\/152\/96f\/da615296f58a451002ef6e8551998233.svg\" alt=\"$S = X \\cdot X^T$\" data-tex=\"inline\"><\/math>. \u041e\u043d\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0432\u044b\u043a\u043b\u0430\u0434\u043a\u0430\u0445, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u043b\u0438\u043d\u0435\u0439\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0432 ML. \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e \u0432 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/6d6\/a4f\/78f\/6d6a4f78fbacd6edecc018ce8ad3e364.svg\" alt=\"$X$\" data-tex=\"inline\"><\/math> \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/839\/f25\/c27\/839f25c2746382debd4f08ea25ad5ecf.svg\" alt=\"$p$\" data-tex=\"inline\"><\/math> \u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/d68\/cc4\/926\/d68cc4926bf74bae8fa3b51ca4a09ec8.svg\" alt=\"$q$\" data-tex=\"inline\"><\/math> \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0442\u0440\u0451\u0445\u043c\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/9a1\/572\/352\/9a1572352266443de720dc50f687e03e.svg\" alt=\"$\\vec {r _ p}, \\vec {r_q}$\" data-tex=\"inline\"><\/math>, \u0442\u043e \u043c\u0430\u0442\u0440\u0438\u0446\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cb6\/d45\/cf9\/cb6d45cf916546ae1085088c0c5dcd09.svg\" alt=\"$S$\" data-tex=\"inline\"><\/math> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u044d\u0442\u0438\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432. \u0422\u0430\u043a\u0438\u0445 \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/08d\/9fa\/efb\/08d9faefbe272bdf8fbb80773542e343.svg\" alt=\"$n$\" data-tex=\"inline\"><\/math> \u0448\u0442\u0443\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cb6\/d45\/cf9\/cb6d45cf916546ae1085088c0c5dcd09.svg\" alt=\"$S$\" data-tex=\"inline\"><\/math> \u0440\u0430\u0432\u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/ae8\/faf\/6b0\/ae8faf6b0ed8c1c58deceac8a026fb45.svg\" alt=\"$n \\times n$\" data-tex=\"inline\"><\/math>.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kh\/bw\/ct\/khbwctgydbzj51g5qwybvxtr9wo.png\"><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cb6\/d45\/cf9\/cb6d45cf916546ae1085088c0c5dcd09.svg\" alt=\"$S$\" data-tex=\"inline\"><\/math> \u0441\u0442\u043e\u044f\u0442 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0434\u043b\u0438\u043d \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/5e2\/923\/99c\/5e292399cbb46876aeef3218dc19b45c.svg\" alt=\"$\\vec {r_p}: s_{p p} = r_p^2$\" data-tex=\"inline\"><\/math>. \u0417\u043d\u0430\u044f \u044d\u0442\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0440\u0430\u0441\u0447\u0451\u0442\u0430 \u0434\u0432\u0443\u0445 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0442\u0440\u0438\u0446. \u0412 \u043e\u0434\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/cb6\/d45\/cf9\/cb6d45cf916546ae1085088c0c5dcd09.svg\" alt=\"$S$\" data-tex=\"inline\"><\/math> \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445, \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ms\/np\/ps\/msnppskk5fbczwgqvelu3jgeo80.png\"><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f <code>p_roll + q_roll - 2 * S<\/code><\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cc\/py\/ii\/ccpyiidioj3yrxqnpxxbuyt8ht0.png\"><\/p>\n<p>  <\/p>\n<p>\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/c64\/3cd\/f56\/c643cdf56d1419f71ca4dac742f06603.svg\" alt=\"$(p, q)$\" data-tex=\"inline\"><\/math> \u043c\u0430\u0442\u0440\u0438\u0446\u044b <code>sq_dist<\/code> \u0440\u0430\u0432\u0435\u043d <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/a0f\/52b\/8d8\/a0f52b8d87b4d48a2edbff315d394149.svg\" alt=\"$r_p^2 + r_q^2 - 2\\cdot (\\vec {r_p} , \\vec {r_q}) = (\\vec {r_p} - \\vec {r_q})^2$\" data-tex=\"inline\"><\/math>. \u0422\u043e \u0435\u0441\u0442\u044c, \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043e\u0432 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u0447\u043a\u0430\u043c\u0438. <\/p>\n<p>  <\/p>\n<h3 id=\"elektrostaticheskoe-ottalkivanie-na-sfere\">\u042d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0444\u0435\u0440\u0435<\/h3>\n<p>  <\/p>\n<p><code>dist = np.sqrt(sq_dist)<\/code> \u2014 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u0447\u043a\u0430\u043c\u0438. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u0447\u0435\u043a \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0438 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u0435 \u043a \u0441\u0444\u0435\u0440\u0435. \u041f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0435\u043c\u0443 (\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u043b\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0443!): <code>rec_dist_one = 1 \/ (dist + np.eye(n))<\/code>. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u0430, \u043d\u0430 \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u043e\u044f\u0442 \u0435\u0434\u0438\u043d\u0438\u0446\u044b, \u0434\u0440\u0443\u0433\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u2014 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044b \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u0447\u043a\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b. \u0420\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u0442 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0441\u0444\u0435\u0440\u044b <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/3af\/47a\/70d\/3af47a70d392249f2233c8a3e9997063.svg\" alt=\"$(1 - r)$\" data-tex=\"inline\"><\/math>. \u0412\u043e\u0437\u0432\u043e\u0434\u0438\u043c \u0435\u0433\u043e \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 <math><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/formulas\/16d\/a50\/7b2\/16da507b2fc389688ef0659939dcc647.svg\" alt=\"$k$\" data-tex=\"inline\"><\/math>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0434\u0430\u0451\u0442 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0440\u043e\u043b\u044c\u044e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u0438\u0446 \u0438 \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f \u0441\u0444\u0435\u0440\u044b. \u0418\u0442\u043e\u0433\u043e <code>k = 1000<\/code>, <code>all_interactions = rec_dist_one - torch.eye(n) + (d.sqrt() - torch.ones(n))**2<\/code>. \u0414\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0442\u0435\u0440\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c: <code>t = all_interactions.sum()<\/code><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 numpy:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">S = X.dot(X.T)  # \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0441\u043a\u0430\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0439 pp_sq_dist = np.diag(S)  # \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c p_roll = pp_sq_dist.reshape(1, -1).repeat(n, axis=0)  # \u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c q_roll = pp_sq_dist.reshape(-1, 1).repeat(n, axis=1)  # \u0440\u0430\u0437\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c pq_sq_dist = p_roll + q_roll - 2 * S  # \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0430\u0440\u0430\u043c\u0438 \u0442\u043e\u0447\u0435\u043a pq_dist = np.sqrt(pq_sq_dist)  # \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 pp_dist = np.sqrt(pp_sq_dist)  # \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0434\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b surface_dist_sq = (pp_dist - np.ones(n)) ** 2  # \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u044b \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u043e \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b rec_pq_dist = 1 \/ (pq_dist + np.eye(n)) - np.eye(n)  # \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044b \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0442\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 L_np_rec = rec_pq_dist.sum() \/ 2  # \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f L_np_surf = k * surface_dist_sq.sum()  # \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b \u043f\u0440\u0438\u0442\u044f\u0436\u0435\u043d\u0438\u044f \u043a \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438 \u0441\u0444\u0435\u0440\u044b L_np = (L_np_rec  + L_np_surf) \/ n  # \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u0430, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0430\u044f\u0441\u044f \u043d\u0430 \u043e\u0434\u043d\u0443 \u0442\u043e\u0447\u043a\u0443 print('loss =', L_np)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0447\u0443\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u2014 200 \u043c\u0441 \u043d\u0430 2000 \u0442\u043e\u0447\u0435\u043a.<\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c pytorch:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import torch  pt_x = torch.from_numpy(X) # pt_x - \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 tensor \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 pytorch pt_S = pt_x.mm(pt_x.transpose(0, 1))  # mm - matrix multiplication pt_pp_sq_dist = pt_S.diag() pt_p_roll = pt_pp_sq_dist.repeat(n, 1) pt_q_roll = pt_pp_sq_dist.reshape(-1, 1).repeat(1, n) pt_pq_sq_dist = pt_p_roll + pt_q_roll - 2 * pt_S pt_pq_dist = pt_pq_sq_dist.sqrt() pt_pp_dist = pt_pp_sq_dist.sqrt() pt_surface_dist_sq = (pt_pp_dist - torch.ones(n, dtype=torch.float64)) ** 2 pt_rec_pq_dist = 1\/ (pt_pq_dist + torch.eye(n, dtype=torch.float64)) - torch.eye(n, dtype=torch.float64) L_pt = (pt_rec_pq_dist.sum() \/ 2 + k * pt_surface_dist_sq.sum()) \/ n print('loss =', float(L_pt))<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, tensorflow:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import tensorflow as tf  tf_x = tf.placeholder(name='x', dtype=tf.float64) tf_S = tf.matmul(tf_x, tf.transpose(tf_x)) tf_pp_sq_dist = tf.diag_part(tf_S) tf_p_roll = tf.tile(tf.reshape(tf_pp_sq_dist, (1, -1)), (n, 1)) tf_q_roll = tf.tile(tf.reshape(tf_pp_sq_dist, (-1, 1)), (1, n)) tf_pq_sq_dist = tf_p_roll + tf_q_roll - 2 * tf_S tf_pq_dist = tf.sqrt(tf_pq_sq_dist) tf_pp_dist = tf.sqrt(tf_pp_sq_dist) tf_surface_dist_sq = (tf_pp_dist - tf.ones(n, dtype=tf.float64)) ** 2 tf_rec_pq_dist = 1 \/ (tf_pq_dist + tf.eye(n, dtype=tf.float64)) - tf.eye(n, dtype=tf.float64) L_tf = (tf.reduce_sum(tf_rec_pq_dist) \/ 2 + k * tf.reduce_sum(tf_surface_dist_sq)) \/ n  glob_init = tf.local_variables_initializer()  # \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445  with tf.Session() as tf_s:  # \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u0442\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c     glob_init.run()  # \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e     res, = tf_s.run([L_tf], feed_dict={tf_x: x})  # \u0432\u0441\u0451 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b\u0438     print(res)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u0438\u0445 \u0442\u0440\u0451\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432:<\/p>\n<p>  <\/p>\n<table>\n<tr>\n<td> N <\/td>\n<td>python<\/td>\n<td>numpy<\/td>\n<td>pytorch<\/td>\n<td>tensorflow<\/td>\n<\/tr>\n<tr>\n<td> 2000 <\/td>\n<td> 4.03 <\/td>\n<td> 0.083 <\/td>\n<td> 1.11 <\/td>\n<td> 0.205 <\/td>\n<\/tr>\n<tr>\n<td> 10000 <\/td>\n<td> 99 <\/td>\n<td> 2.82 <\/td>\n<td> 2.18 <\/td>\n<td> 7.9 <\/td>\n<\/tr>\n<\/table>\n<p>  <\/p>\n<p>\u0412\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u044e\u0442 \u0432\u044b\u0438\u0433\u0440\u044b\u0448 \u0431\u043e\u043b\u0435\u0435 \u0447\u0435\u043c \u043d\u0430 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0434\u0435\u0441\u044f\u0442\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u043c python. \u0412\u0438\u0434\u0435\u043d &#171;boiler plate&#187; \u0443 pytorch: \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u043b\u043e\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f, \u043d\u043e \u043e\u043d\u043e \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0451\u043c\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<h3 id=\"vizualizaciya\">\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>  <\/p>\n<p>\u0412 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a Matlab, Wolfram Mathematics, Maple, Matplolib \u0438 \u0442. \u0434. \u0438 \u0442. \u043f. \u0412 \u044d\u0442\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0434\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0432\u0435\u0449\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u0442\u043e\u0431\u043e\u0439 \u0441\u0442\u043e\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043d\u043e \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0442\u044b \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0448\u044c\u0441\u044f \u0431\u0435\u0437\u043e\u0440\u0443\u0436\u0435\u043d. \u041c\u043e\u0451 \u043b\u044e\u0431\u0438\u043c\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438 \u2014 povray. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u044e\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u043e\u0442\u043e\u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043d\u043e \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a &#171;\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438&#187;. \u041e\u0431\u044b\u0447\u043d\u043e, \u0441\u043a\u043e\u043b\u044c \u0431\u044b \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043d\u0438 \u0431\u044b\u043b\u0430 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c povray \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u0444\u0435\u0440\u044b \u0441 \u0446\u0435\u043d\u0442\u0440\u0430\u043c\u0438, \u043b\u0435\u0436\u0430\u0449\u0438\u043c\u0438 \u043d\u0430 \u044d\u0442\u043e\u0439 \u043f\u043e\u0432\u0435\u0440\u0445\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 vapory \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c povray-\u0441\u0446\u0435\u043d\u0443 \u043f\u0440\u044f\u043c\u043e \u0432 python, \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442\u044c \u0435\u0451 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u043d \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fh\/1j\/6x\/fh1j6xkcdedx1m4s0x9clmsgjse.gif\"><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import vapory from PIL import Image  def create_scene(moment):     angle = 2 * math.pi * moment \/ 360     r_camera = 7     camera = vapory.Camera('location', [r_camera * math.cos(angle), 1.5, r_camera * math.sin(angle)], 'look_at', [0, 0, 0], 'angle', 30)     light1 = vapory.LightSource([2, 4, -3], 'color', [1, 1, 1])     light2 = vapory.LightSource([2, 4, 3], 'color', [1, 1, 1])     plane = vapory.Plane([0, 1, 0], -1, vapory.Pigment('color', [1, 1, 1]))     box = vapory.Box([0, 0, 0], [1, 1, 1],                       vapory.Pigment('Col_Glass_Clear'),                      vapory.Finish('F_Glass9'),                      vapory.Interior('I_Glass1'))     spheres = [vapory.Sphere( [float(r[0]), float(r[1]), float(r[2])], 0.05, vapory.Texture(vapory.Pigment('color', [1, 1, 0]))) for r in x]     return vapory.Scene(camera, objects=[light1, light2, plane, box] + spheres, included=['glass.inc'])  for t in range(0, 360):     flnm = 'out\/sphere_{:03}.png'.format(t)     scene = create_scene(t)     scene.render(flnm, width=800, height=600, remove_temp=False)     clear_output()     display(Image.open(flnm))<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0437 \u043a\u0443\u0447\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 gif \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e ImageMagic:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">convert -delay 10 -loop 0 sphere_*.png sphere_all.gif<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u0447\u043a\u0438 \u0432\u044b\u0448\u043b\u0438 \u0438\u0437 \u043a\u0443\u0431\u0430 \u0438 \u0440\u0430\u0432\u043d\u043e\u043c\u0435\u0440\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u0437\u043b\u0438\u0441\u044c \u043f\u043e \u0441\u0444\u0435\u0440\u0435.<\/p>\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\/424227\/\"> https:\/\/habr.com\/post\/424227\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<p>\u042d\u0442\u043e\u0442 \u0442\u0435\u043a\u0441\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442\u0441\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u043c \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a pytorch \u0438 tensorflow \u0434\u043b\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0443\u044e\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e numpy \u0432\u0435\u043a\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0440\u0438\u0447\u043d\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0410 \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u0443\u043b\u044c\u0442\u0444\u0438\u043b\u044c\u043c \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PovRay \u0438 vapory. <\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/kz\/fa\/h2\/kzfah2g6zgoehvsimumi8hy9nie.jpeg\"><\/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-289824","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289824","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=289824"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/289824\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}