Archive for December, 2007


Perl

December 6th, 2007
$max_val = 0;d
$max_m = 0;
$max_n = 0;
 
for ($m = 1; $m < 1982; $m++) {
   for ($n = 1; $n < 1982; $n++) {
      $val = $n*$n - $m*$n - $n*$n;
      $val = $val*$val;
 
      if($val == 1)
      {
         $val = $m*$m + $n*$n;
 
         if($val > $max_val)
         {
            $max_val = $val;
            $max_m = $m;
            $max_n = $n;
         }
      }
   }
}
 
print "Max Value: ".$max_val." m: ". $max_m." n: ".$max_n;

Test

December 1st, 2007

Question: Write down the equation of motion for a charged particle in uniform, parallel electric and magnetic fields, both in the z-direction, and solve it, given that the particle starts from the origin with the velocity (v_0,0,0). A screen is placed at x=a where a \ll  \frac{mv}{qB}. Show that the locus of points of arrival of particles with given m and q, but different speeds v_0, is approximately a parabola.

Answer: The equation of motion is given by the Lorentz Force equation:

m\ddot{r} = q \vec{E} + q \dot{r} \times \vec{B}

However, since \vec{E} = E \hat{k} and \vec{B} = B \hat{k} for this problem, the equation of motion becomes

m\ddot{r} = q  E \hat{k} + q \dot{r} \times B \hat{k}

which reduces to

m \ddot{x} = q\dot{y}B, m\ddot{y} = - q\dot{x}B, m \ddot{z} = qE

First, lets solve \ddot{z} = \frac{qE}{m}. If we integrate \ddot{z}, we get

\dot{z}(t) = \int \frac{qE}{m}dt = \frac{qE}{m}t + C
since the initial velocity at t=0 is (v_0,0,0), this means \dot{z}(0) = 0.

Therefore, \dot{z} = \frac{qE}{m}t.
If we integrate again, we get:

z(t) = \int \frac{qE}{m}tdt = \frac{qE}{2m}t^{2} +C
since the initial position at t=0 is (0,0,0), this means z(0) = 0.

Therefore, z = \frac{qE}{2m}t^{2}.

Next, we will reduce the other two equations

\ddot{x} = \frac{qB}{m}\dot{y}
\dot{x} = \int \frac{qB}{m}\dot{y}dt = \frac{qB}{m}y + C
since \dot{x}(0) = v_0, therefore \dot{x} = \frac{qB}{m}y + v_0.

We can similar reduce \ddot{y}

\ddot{y} = -\frac{qB}{m}\dot{x}
\dot{y} = -\int\frac{qB}{m}\dot{x}dt = -\frac{qB}{m}x +c
since \dot{y}(0) = 0, therefore \dot{y} = -\frac{qB}{m}x.

If we put these equations into the original equations of motion, we can decouple the x and y terms.

\ddot{x} = \frac{qB}{m}(-\frac{qB}{m}x) = - (\frac{qB}{m})^{2}x

which has a general solution of

x = Asin(\frac{qB}{m}t) + Bcos(\frac{qB}{m}t)

However, since x(0) = 0, therefore x = Asin(\frac{qB}{m}t).
In order to calculate A, we need to take the derivative.

\dot{x} = \frac{AqB}{m}cos(\frac{qB}{m}t)
since \dot{x}(0) =v_0, the following reduction can be made \frac{AqB}{m} = v_0 \Rightarrow A = \frac{m v_0}{qB}.

Therefore, x = \frac{m v_0}{qB}sin(\frac{qB}{m}t) and \dot{x} =v_0 cos(\frac{qB}{m}t).

Also, since \dot{x} = \frac{qB}{m}y +v_0, we can solve for y

v_0 cos(\frac{qB}{m}t) = \frac{qB}{m}y + v_0
y = \frac{v_0 m}{qB}(cos(\frac{qB}{m}t) - 1)

This means the equation of motion is:

x = \frac{m v_0}{qB}sin(\frac{qB}{m}t)
y = \frac{v_0 m}{qB}(cos(\frac{qB}{m}t) - 1)
z = \frac{qE}{2m}t^{2}