# Physics 212, 2019: Lecture 4

Back to the main Teaching page.

## An example of a model: Solving for an equilibrium position, light version

A charged particle free to move on a rod is put in the between two particles with an electric charge of the same sign affixed to the end of the rod. Where will the charge come to rest?

Analysis
How should we model this? is the model dynamic or static? At the first sign, this is a dynamic model, since we are talking about motion of a charge. On the other hand, we are asked only about the final equilibrium position. Then maybe this is a static model after all -- we only need to know where the charge comes to rest. The model is definitely a continuous space model -- position of the particle is a continuous variable. The model is also deterministic -- there's not a stochastic element present. To make this a static model (so that there's a final rustic point for the charge), there has to be friction, so that the particle does not keep oscillating infinitely. Nothing is mentioned about this in the problem formulation -- but it seems like this is presumed.Does it even make sense that the particle will come to a rest? Same sign particles repel. And the repulsion is stronger when they come closer. So a particle between two other fixed one will be pushed away from both ends -- it seems reasonable that it will come to a steady point at some time if friction robs it of energy.
Model building
The equilibrium for the system will be ${\displaystyle \sum {\vec {F}}=0}$. Since the particle is moving on a rod -- in one dimension -- this is equivalent to ${\displaystyle \sum {F}=0}$. There are two Coulomb forces acting on the particle from the two end charges. Let's say the charges are at positions ${\displaystyle x_{1}}$ and ${\displaystyle x_{2}}$, and have charges ${\displaystyle q_{1}}$ and ${\displaystyle q_{2}}$respectively. Let's suppose ${\displaystyle x_{1}, where ${\displaystyle x}$ is the position of the moving charge. The forces acting on the moving charge, which we call ${\displaystyle q}$ are then ${\displaystyle \sum F={\frac {qq_{1}}{(x-p_{1})^{2}}}-{\frac {qq_{2}}{(x-p_{2})^{2}}}}$. Thus to solve the problem, we need to solve the following equation for ${\displaystyle x}$: ${\displaystyle {\frac {qq_{1}}{(x-p_{1})^{2}}}-{\frac {qq_{2}}{(x-p_{2})^{2}}}=0}$, or, cancelling ${\displaystyle q}$, ${\displaystyle {\frac {q_{1}}{(x-p_{1})^{2}}}-{\frac {q_{2}}{(x-p_{2})^{2}}}=0}$. Interestingly, the only variables we need for initialization are the three charge values, and the two end charge positions -- the initial position of the moving charge, and charge value itself seem to be not needed. Multiplying the equation by the two denominators (which, luckily, cannot be zero), we get: ${\displaystyle {q_{1}}{(x-p_{2})^{2}}-{q_{2}}{(x-p_{1})^{2}}=0}$. Simplifying the equation, we get: ${\displaystyle (q_{1}-q_{2})x^{2}+2(-q_{1}p_{2}+q_{2}p_{1})x+(q_{1}p_{2}^{2}-q_{2}p_{1}^{2})=0}$. So it seems that solving this problem is equivalent to solving a simple quadratic equation.
Model implementation
To build a model, we start with large blocks describing chunks of the solution of the problem. We progressively break them apart into smaller and smaller blocks, until we are able to write the code for each one of the blocks. At the same time, as we are implementing the blocks, we collect pieces that need to be initialized in the initialization block, and need to be reported in the termination block. Here we realize that, in the previous class hour, we wrote a simple program that solves the quadratic equation ${\displaystyle ax^{2}+bx+c=0}$. Thus implementing the model is equivalent to taking the previously written solution for the quadratic. Thus the implementation will consist of just three blocks: (1) initialization, where we assign ${\displaystyle a=q_{1}-q_{2}}$, ${\displaystyle b=2(-q_{1}p_{2}+p_{2}x_{1})}$, and ${\displaystyle q_{1}p_{2}^{2}+q2p_{1}^{2}}$; (2) solving the quadratic equation and getting its two solutions; and (3) termination, where, of the two solutions, we then output the one that falls between ${\displaystyle p_{1}}$ and ${\displaystyle p_{2}}$.
Model verification
To verify that the solution is correct, we should try it in cases where the solution is easy to guess or to estimate otherwise, and compare. For example, we can try ${\displaystyle q_{1}=q_{2}}$, where it's clear that the solution should be ${\displaystyle x=(p_{1}+p_{2})/2}$. We could also choose a few conditions with different ${\displaystyle q_{1}}$, and we would expect that growing ${\displaystyle q_{1}}$ should push the equilibrium farther from the left end.
Discussion
Having solved the problem, we would usually discuss our findings here, and reiterate various constraints and assumptions that entered the solution. However, this problem is too simple too write much here.