lorentz-force

a tool to model the effect of a magnetic force on a particle in a three-dimensional field

  • 所有者: catherinemoresco/lorentz-force
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

lorentz-force

A simulator of the effect of a magnetic force in an electric field, built with numpy and pyplot.

Parameters are hard-coded into the file; the area where they should be modified is clearly delineated, and the importance of the various variables are noted in the comments. Especially relevant is the comment on the limitation of the correctness of Euler's method of numerical integration; users should be careful to set their step size small enough to combat the existence of artifactual spiraling in what should be uniform circular motion--e.g. what occurs in a constant magnetic field.

B Fields

Here are some example outputs:
Figure 1

Here, we have three particle trajectories in a constant magnetic field. The black trajectory is a particle traveling wholly perpendicular to the magnetic field—its path is a circle, as expected. The red path is a particle with velocity components both parallel to and perpendicular to the field, resulting in a helix—it also has a greater mass, which results in a wider curvature of path. The blue line is a particle traveling completely parallel to the force—its motion is not affected at all.

With a wackier, arbitrary B field (b = np.array([2, 0, .1*z]), we get something sillier:
Figure 2

E Fields

The fun doesn't stop there...we can handle E fields too! Take a look at the next example, with a constant E field. Note the blue path, a particle that starts at rest, approximates cycloid motion! Cycloids are really, really cool for a lot of reasons (they're solutions to both the tautochrone and brachistochrone problems! I'm so excited!).
Figure 3

LET'S GET CRAZY

Figure 4
We added a point charge here, which doesn't actually exert enough force to do anything too funky, except for the weird loop that the start of the red trajectory.

Figure 5
What happens if you use an E field of the form of a sin function? This. This happens.

Figure 6
Now I'm just honestly messing around. But I'm having a good time.

Figure 7
This is the same thing as last time, but I let it run for ten times as long. Woooooooah.

主要指標

概覽
名稱與所有者catherinemoresco/lorentz-force
主編程語言Python
編程語言Python (語言數: 1)
平台
許可證
所有者活动
創建於2015-03-06 11:40:34
推送於2021-08-23 04:34:53
最后一次提交2015-03-29 21:02:09
發布數0
用户参与
星數9
關注者數1
派生數2
提交數19
已啟用問題?
問題數0
打開的問題數0
拉請求數0
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?