{"id":1154,"date":"2014-07-01T15:00:38","date_gmt":"2014-07-01T07:00:38","guid":{"rendered":"http:\/\/www.hsyyf.me\/?p=1154"},"modified":"2014-07-01T15:00:38","modified_gmt":"2014-07-01T07:00:38","slug":"%e6%ac%a7%e6%8b%89%e6%8a%98%e7%ba%bf%e6%b3%95%e7%bb%98%e5%88%b6%e7%94%b5%e5%9c%ba%e7%ba%bf%e5%8a%a8%e7%94%bb","status":"publish","type":"post","link":"https:\/\/www.hsyyf.me\/?p=1154","title":{"rendered":"\u6b27\u62c9\u6298\u7ebf\u6cd5\u7ed8\u5236\u7535\u573a\u7ebf\u52a8\u753b"},"content":{"rendered":"<p><!--wp_fromhtmlpreview_devfmt--><\/p>\n<p>\n\t<!--wp_fromhtmlpreview_devfmt-->\n<\/p>\n<p>\n\tpython\u5199\u7684\u52a8\u753b\uff0c\u7528\u7684\u662fVpython\u5e93\uff0c\u9700\u8981\u4eceVTK\u5b98\u7f51\u4e0b\u8f7d\uff0c\u76ee\u524d3.x\u7684python\u53ea\u67093.3\u6709\u8fd9\u4e2a\u5e93\uff0c3.4\u8fd8\u6ca1\u6709\u3002\u4f9d\u65e7\u7528\u7684\u662f\u6b27\u62c9\u6298\u7ebf\u6cd5\u7ed8\u5236\u7535\u573a\u7ebf\u7684\u8f68\u8ff9\uff0c\u548c\u4e0a\u4e00\u7bc7\u7684Fortran\u662f\u4e00\u6837\u7684\u7b97\u6cd5\u3002\n<\/p>\n<p><code lang=\"python\">#!\/usr\/bin\/python<br \/>\nfrom visual import *<br \/>\nimport cmath as cm<br \/>\nimport numpy<\/p>\n<p>ball1=sphere(pos=(1.0,1.0,0.0),radius=0.3,color=color.red)<br \/>\nball2=sphere(pos=(-1.0,1.0,0.0),radius=0.3,color=color.blue)<br \/>\nball3=sphere(pos=(-1.0,-1.0,0.0),radius=0.3,color=color.red)<br \/>\nball4=sphere(pos=(1.0,-1.0,0.0),radius=0.3,color=color.blue)<br \/>\nball=[ball1,ball2,ball3,ball4]<br \/>\nq=numpy.array([1.0,-1.0,1.0,-1.0])<br \/>\nground=box(pos=(0.0,0.0,0.0),size=(12.0,12.0,0.1),opacity=0.2)<br \/>\ndt=0.002<br \/>\nN=30<br \/>\nrate(5)<\/p>\n<p>for i in range(len(q)):<br \/>\n    for j in range(N):<br \/>\n        p=0.32*cm.exp(j*cm.pi*(0.0+1.0j)*2.\/real(N))<br \/>\n        line=sphere(pos=(ball[i].x+p.real,ball[i].y+p.imag,0.0),<br \/>\n        radius=0.02,color=color.red)<br \/>\n        line.trail=curve(color=line.color)<br \/>\n        line.trail.append( pos = line.pos, color = (1, 0, 0))<br \/>\n        while not(abs(line.pos)>15.0 or abs(line.pos-ball[1].pos)<0.32 \n        or abs(line.pos-ball[2].pos)<0.32 or abs(line.pos-ball[3].pos)<0.32 \n        or abs(line.pos-ball[0].pos)<0.32):\n            E=line.pos*0.0\n            if i in [0,2]:\n                for k in range(len(ball)):\n                    E+=q[k]*(line.pos-ball[k].pos)\/abs(line.pos-ball[k].pos)**3.0\n            else:\n                for k in range(len(ball)):\n                    E-=q[k]*(line.pos-ball[k].pos)\/abs(line.pos-ball[k].pos)**3.0\n                    \n            line.pos+=dt*E\/abs(E)\n            line.trail.append( pos = line.pos, color = (1, 0, 0))\n<\/code><\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t\u6548\u679c\u5982\u56fe\uff1a\n<\/p>\n<p>\n\t<a href=\"http:\/\/www.hsyyf.me\/wp-content\/uploads\/2014\/07\/Eline.png\"><img loading=\"lazy\" decoding=\"async\" alt=\"Eline\" class=\"aligncenter size-medium wp-image-1158\" height=\"181\" src=\"http:\/\/www.hsyyf.me\/wp-content\/uploads\/2014\/07\/Eline-300x181.png\" width=\"300\" srcset=\"https:\/\/www.hsyyf.me\/wp-content\/uploads\/2014\/07\/Eline-300x181.png 300w, https:\/\/www.hsyyf.me\/wp-content\/uploads\/2014\/07\/Eline-1024x620.png 1024w, https:\/\/www.hsyyf.me\/wp-content\/uploads\/2014\/07\/Eline.png 1374w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>python\u5199\u7684\u52a8\u753b\uff0c\u7528\u7684\u662fVpython\u5e93\uff0c\u9700\u8981\u4eceVTK\u5b98\u7f51\u4e0b\u8f7d\uff0c\u76ee\u524d3.x\u7684python\u53ea\u67093.3\u6709\u8fd9\u4e2a\u5e93 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[3],"tags":[87,153,152],"class_list":["post-1154","post","type-post","status-publish","format-standard","hentry","category-3","tag-python","tag-153","tag-152"],"_links":{"self":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts\/1154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1154"}],"version-history":[{"count":0,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=\/wp\/v2\/posts\/1154\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hsyyf.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}