So you just need one ball in the rectangle?
What do you mean by rolling friction?
If the rolling friction is large enough then the ball's motion is moving without slipping.
It means that there is no energy loss.
What about the collision between the ball and the wall?
If it is elastic collision, then the energy is also conserved.
I will create the simulation with easy java simulation. It is easier to create it this way.
Is this what you want? You can use mouse to drag and drop either particle position or velocity vector (click checkbox to show velocity). Change b value to add drag forces or clcik constant drag.