% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2012_fall_practical_computing_for_scientists/midterm01/body/midterm01.2012.tex"
% LAST MODIFICATION: "Fri, 21 Sep 2012 11:46:29 -0400 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$


{\bf Problem (100 points total)}
%---------------------------------------------------------------

We will discuss the following problem in the 2D case.

Consider the set of $N$ charged particles distributed in the plane $xy$. 
The electric potential of such a system at the point $\vec{r}$
is equal to 
\begin{eqnarray*}
	V(\vec{r}) = K \sum_{i=1}^N \frac{q_i}{|\vec{r}-\vec{r}_i|}
\end{eqnarray*}
where $q_i$ is the charge of the $i^{th}$ particle, $\vec{r}_i$ is the position of the
$i^{th}$ particle, and $K=9\times10^9 ~ (N ~ m^2)/C^2$ is Coulomb's constant.

You will be provided with a file ``particles.dat'' which will contain the
particles' properties: 1st column corresponds to the particles' charges, 2nd
column to their $x$ coordinates, and 3rd to their $y$ coordinates. Charges are
given in Coulombs, and coordinates are in meters.

\vskip .2in
%---------------------------------------------------------------
{\flushleft \bf Task 1}

Plot the particles' positions, depicting positively charged particles with red
markers and negatively charged with blue markers.

\vskip .2in
%---------------------------------------------------------------
{\flushleft \bf Task 2}

Find at least one point along $x$ where the potential is equal to zero.
This point must be the closest to the $y$  axis.

\vskip .2in
%---------------------------------------------------------------
{\flushleft \bf Task 3}

Someone moved a very thin and uniformly charged rod  from far away to the
place with the rod's end points' (x,y) coordinates equal to ($x_0,y_b$) and ($x_0,y_t$). 
So the rod is parallel to
the $y$ axis.
Find the total electric energy change of such a system after such a move. 
The rod's linear charge density is $\mu = 10^{-5} ~ C/m$. Here $x_0=-1$, $y_b=-1$,
and $y_t=1$.

Hint: you will need to integrate
\begin{eqnarray*}
E= K \mu \sum_{i=1}^N \int_{y_b}^{y_t} \frac{q_i}{\sqrt{ (x_i-x_0)^2 + (y-y_i)^2}} dy
\end{eqnarray*}


\vskip .2in

{\bf Bonus is harder but it is within reach!}

{\bf Bonus (10 points):}
Find the electric energy change due to a charged rectangular sheet, brought from far away such that 
the corners are placed to the following coordinates: (0,2) and (1,0). The rod
was removed far away before we started moving the sheet.
For bonus you are not allowed to use any of the matlab integration
functions (i.e. integral, integral2, quad, and so on).

