Basic kinematics

Kinematics is all about motion. And since we are now moving away from pure electrostatics, it is about time to introduce some motion of particles.

In exercise set 6 we ask you to simulate the motion of a particle in an electric field using numeric methods. This is likely something you have seen before, so we’ll just briefly restate the most important concepts here.

Numerical integration

To determine the motion of any particle, we need to find the position as a function of time. This is usually done by observing that the double derivative of the position, namely the acceleration, can be integrated over time to give back the position. However, evaluating the integral

$$\mathbf r(t) = \int \int \mathbf a(t, \mathbf v(t), \mathbf r(t)) ~dt~dt$$

is no trivial task, except for the cases where $\mathbf a$ is constant. That’s why numerical integration is so useful when working with more complicated problems, especially when $\mathbf a$ is a function of $\mathbf r$ and $\mathbf v$.

In numerical integration, we divide the time into discrete steps, where we at each step recalculate the acceleration, velocity and position. One of the simplest of these schemes is the Euler-Cromer scheme.

In the Euler-Cromer scheme, we increase the current velocity by adding the acceleration at each time step. The acceleration is then a function of the current time, and the position and velocity at the previous time step.

$$\mathbf v(t_{i+1}) = \mathbf v(t_i) + \mathbf a(t_{i}, \mathbf r(t_i), \mathbf v(t_i)) \cdot \Delta t$$

Similarily, we find the position using the velocity we just calculated for the current time step:

$$\mathbf r(t_{i+1}) = \mathbf r(t_i) + \mathbf v(t_{i+1}) \cdot \Delta t$$

We have to do this from the first step in time till the last, and in terms of code this is translated into a for-loop. In Python we may express this as a small script:

from pylab import *

dt = 1e-3
t0 = 0
t1 = 10
t = linspace(t0, t1, (t1 - t0)/dt)

r1 = zeros((len(t),3))
v1 = zeros((len(t),3))

r1[0] = [0.0, 0.0, 0.0]
v1[0] = [0.0, 0.0, 0.0]

for i in range(len(t)-1): 
    a1 = array([5.0, 0.0, 0.0])
    v1[i+1] = v1[i] + a1*dt
    r1[i+1] = r1[i] + v1[i+1]*dt

figure()
plot(t, r1[:,0], label="Motion in x direction")
xlabel("$t$",fontsize=16)
ylabel("$x$",fontsize=16)
legend()
show()

To run this in an IPython terminal, just save it to file a file named “kinematics.py” and launch it by running the following commands in the folder where you saved the file:

ipython --pylab
run kinematics.py

Here we are using vectors, generated by linspace. The linspace function does in this case generate an array of 3-dimensional vectors, where the first argument, len(t), tells linspace that we want as many such vectors as there are time steps. The second argument, 3, tells linspace that each vector is three-dimensional.

The reason for using vectors (instead of 3 arrays of length len(t)) is that it makes it simple to write the following two statements in a way that is easy to read and remember:

r1[0] = [0.0, 0.0, 0.0]
v1[0] = [0.0, 0.0, 0.0]

This sets the first vectors of our position and velocity, also known as the initial conditions. In this case we have chosen the components of both to be $x = 0$, $y = 0$ and $z = 0$.

The for-loop is basically what we defined as the Euler-Cromer scheme above, with a constant acceleration vector in the $x$-direction:

for i in range(len(t)-1): 
    a1 = array([5.0, 0.0, 0.0])
    v1[i+1] = v1[i] + a1*1e-4
    r1[i+1] = r1[i] + v1[i+1]*dt

At each time step the position and velocity is not only calculated, but stored to an array that makes it readily available for plotting. The plotting is done for the first component of all $\mathbf r$-vectors as a function of t:

plot(t, r1[:,0], label="Motion in x direction")

A plot showing the $x$-component of the particle’s position as function of time $t$.

This results in a plot looking something like this:

For the case where we are working with a more physical problem, we would have to calculate the force $\mathbf F$ at each time step and find the acceleration from Newton’s second law, $\mathbf a = \frac{F}{m}$.

 

You should now be ready to play around with your own kinematic problems.

Good news for Matlab fans!

We have decided that the oblig can be done in any programming language you like, including Python and Matlab. This means that there will be no need for functions specific to Python or Mayavi to get the oblig approved, and that we will help you with both Matlab and Python during the group sessions.

Just note that if you choose any other language than Python or Matlab, you are a bit on your own when it comes to support. You will also have to make sure that your language of choice generates good-looking plots that meets all requirements such as legend, named axes, etc.

Note also that there is a numeric exercise in set number 6 that might be useful to have done before the oblig is published.

The oblig will be published shortly after the mid-term exam.

 

Equation sheet

We have put together an equation sheet that you will be handed on the mid-term and final exam. The sheet is not complete, so please be aware of errors and missing equations, and check in here frequently to download the latest version.

If you miss something that you would like to have included in the equation sheet, don’t hesitate to ask us to include it. (We can’t guarantee that we’ll accept any proposal, though.)

 

Maxwell’s equations

Last weekend Fysisk fagutvalg arranged the annual cabin trip, and in that regard Jørgen Midtbø held a lecture on Maxwell’s equations. Those of you who were there are already familiar with the content, but for the rest of you we post the note from this lecture that may be useful to read through. You can find the note here

Enjoy!

Online lectures from MIT with Walter Lewin

If you have missed out on some of the lectures or feel you could need a second view on some subjects, we recommend having a look at Walter Lewin’s lectures from MIT:

Our syllabus is not the same as in their course, but some lectures are very relevant. For instance there are lectures on Gauss law, electric flux, magnetism and much more that will follow in our course too.

Spending some time watching a few lectures when you have spare time or are tired of reading can help you grasp concepts that you find hard to understand. It could also be very inspiring!

Should you find some lectures especially useful, don’t forget to tip your fellow students about it by leaving a comment below.

Cabin trip with Fysisk Fagutvalg

Fysisk fagutvalg is organizing a cabin trip for FYS1120 students at the KSI-cabin in Nordmarka. The trip is a supplement to the official teaching, and consists of lectures and problem solving with plenty of time to socialize. Important information follows:

  • Price: 100 kr

For those who not have a card for bus, tram, metro in Oslo; you must remember money for public transport.

Packing List

  • School Matters (calculator, writing material)
  • Sleeping bag
  • Slippers
  • Warm clothes (it can get cold at night)
  • Waterproof clothing (it can start to rain!)
  • A flashlight (if you have one).
  • Bags (we don’t have permission to drive up to the KSI-cabin, so everyone must a carry bit. It’s a walk and probably boring to carry a plastic bag all the way)
  • Possibly: Mineral water and alcohol, if you want it, you have to bring yourself.

Contact

For questions about the trip contact FFU: fagutvalg@fys.uio.no

Preliminary program

Saturday:

  • 11.00 Attendance at the pendulum, departure 11.35
  • Those who have not paid yet, you can pay then.
  • (One can withdraw money outside Akademika)
  • Guided walk up to KSI hut
  • Hot lunch at the lodge at about 13.30 (when we get up)
  • Lecture 14.00-15-00
  • Problem solving 3:00 p.m. to 4:00 p.m.
  • Lecture 4:00 p.m. to 5:00 p.m.
  • Dinner ca. 17.00
  • Trail
  • Games and fun the rest of the evening

Sunday:

  • Breakfast 09.00
  • Clearing
  • You are responsible for the room you are on.
  • Departure around 12:00

Electric field lines

We have made a small demo that will allow you to play around with electric field lines in your web browser. You can place and move around charged particles to see how the field changes as you make your own charge configuration.

An electric field line simulator straight in your browser!

Try the simulator here

Note that there are some limitations to this simulation, leaving it a bit unphysical when it comes to lines that might end up in open space, wrong field line density and other quirks. All in all it should be correct to a decent approximation, though.

For the programming enthusiasts out there, the simulation is created using Javascript and HTML5. You can check out the source code here.

Enjoy!