lorentz-force

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

  • Owner: catherinemoresco/lorentz-force
  • Platform:
  • License::
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownercatherinemoresco/lorentz-force
Primary LanguagePython
Program languagePython (Language Count: 1)
Platform
License:
所有者活动
Created At2015-03-06 11:40:34
Pushed At2021-08-23 04:34:53
Last Commit At2015-03-29 21:02:09
Release Count0
用户参与
Stargazers Count9
Watchers Count1
Fork Count2
Commits Count19
Has Issues Enabled
Issues Count0
Issue Open Count0
Pull Requests Count0
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private