Playing tennis in pyoomph - custom expression with dimensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The next problem will be a bit more comprehensive and it will involve several techniques we have learned so far, namely using physical dimensions, custom math expressions and temporal adaptivity. We want to simulate a simple tennis match. As in all physics exams, there is no air friction acting on the ball, the problem is one-dimensional and the tennis rackets behave as a Hookean spring, but only if the position of the ball exceeds the position of the racket. Mathematically, we solve .. math:: m\ddot{x}=F_1(x)+F_2(x) where :math:`F_1` and :math:`F_2` are the forces of the rackets, which take action whenever the ball reaches the positions :math:`X_1` and :math:`X_2` of the rackets: .. math:: F_1(x)=\left\{\begin{matrix} -k_1(x-X_1) & \text{if} \quad x>X_1 \\ 0 & \text{otherwise} \end{matrix} \right. \quad \text{and} \quad F_2(x)=\left\{\begin{matrix} -k_2(x-X_2) & \text{if} \quad x` :download:`Download all examples <../../tutorial_example_scripts.zip>`