Modelling elastic collisions and reflection from wall in 1D box of two particles I have a very simple system of two particles. Particle $A$ and particle $B$. Particle $A$ is acted by constant potential along wall $C$ while no potential is acted on particle $B$. If they both initially are at rest, both have same masses and collision are perfectly elastic, then how do I find the position of particles at given any time?
 
For special case, assuming the particles have no volume, if both particles collide at wall C, then it can be modeled as single particle using center of mass acting on potential of half. The motion keeps repeating and repeating. I only have to calculate in which interval they collide.
How to model this problem in general? Especially after particle $B$ strikes wall. It seems like the particle is moving through center of mass under half it's potential and gets it's velocity decreased suddenly (twice).
 A: I wrote up a quick MATLAB simulation of your problem (copied here). I assumed that a constant potential at C means that the wall is held at a constant electrical potential, meaning that A is a charged particle and B is not. An infinitely large wall at constant potential results in a constant electric field everywhere, so A accelerates towards the wall with constant acceleration. That's a simple situation, so I used that. I also assumed A collides with B elastically and B collides with the wall elastically. Finally, A and B have zero volume.
The simulation takes small steps in time and updates the particles position under constant acceleration (0 in the case of B). When the particles collide or when B collides with the wall, their velocities are updated according to conservation of momentum and kinetic energy.
Here is a plot of the positions of A and B over time where A and B have the same mass and B starts halfway between A and the wall:

This is pretty chaotic motion. However, certain starting conditions result in rather orderly motion. Here is a plot where $m_B = 0.655 m_A$:

I'm not sure if this is an artifact of using discrete steps in the simulation, but smaller step sizes do not change the result.
A different starting position will also result in vastly different motion. Here are equal mass A and B but with B starting much closer to A:

If you're trying to find the interval between bounces, I don't believe you will find any sort of nice expression. The bounce period is chaotic and irregular aside from some special initial conditions.
A: Particle $A$ in homogeneous field $U=-Fx$ feels the force $F$. Thus between collisions its acceleration due to the field is
$$a_A=\frac F {m_A}.\tag1$$
So we can describe its motion between collisions since time $t_i$ as
$$x_A=x_A^{(i)}+(t-t_i)v_A^{(i)}+\frac{a_A(t-t_i)^2}2,\tag2$$
where $x_A^{(i)}$ and $v_A^{(i)}$ are position and velocity of the particle at the moment of $i$th collision and $t_i$ is time of $i$th collision.
The particle $B$ is free between collisions:
$$x_B=x_B^{(i)}+(t-t_i)v_B^{(i)}.\tag3$$
Now equating $x_A=x_B$ we find when the particles could collide:
$$t=\frac{a_At_i-v_A^{(i)}+v_B^{(i)}\pm\sqrt{\left(v_A^{(i)}-v_B^{(i)}\right)^2+2a_A\left(x_B^{(i)}-x_A^{(i)}\right)}}{a_A}.\tag4$$
Here we should choose smallest of $t>t_i$.
Another possibility is collision of either particle with the wall. The particle $A$ would collide with the wall (which we place at $x=0$) at time determined from $x_A=0$:
$$t=\frac{a_At_i-v_A^{(i)}\pm\sqrt{\left(v_A^{(i)}\right)^2-2a_Ax_A^{(i)}}}{a_A}.\tag5$$
Here again we should choose smallest of $t>t_i$. For particle $B$ time of potential collision with the wall is
$$t=t_i-\frac{x^{(i)}}{v_B^{(i)}}.\tag6$$
Now we should compare the times of potential collisions found in $(4)$, $(5)$, $(6)$ and take the smallest of those satisfying $t>t_i$. This is the time of our $i+1$th collision. Computing $x_A$ and $x_B$ at this time $t_{i+1}$ will give us $x_A^{(i+1)}$ and $x_B^{(i+1)}$, from which we restart the computation.
The result will be piecewise-exact expression for the trajectories of the balls, a couple of which is shown in @MarkH's answer.
Note that this problem in general doesn't give periodic motion. We can see this by drawing the potential in configuration space of this system. If we take the energy of the system $E$ and consider points of collisions to be places with $U=U_0>E$, we'll have the following potential:

This looks quite like a triangular billiard table, tilted in the direction of one of the walls. Such system is not quite simple to make the ball perform periodic motion, and in general the paths the ball takes are chaotic.
