Mathematical modelling and problem solving

Bouncing balls programming laboration

This module contains of just one problem: to simulate a model of a dynamical sytsem.


Implement a program that simulates two balls bouncing around a 2D rectangular space under the influence of gravity.

As a starting point, download this Java code. You do not need to change the code in this code displays the balls on the screen. We give you this code so you can concentrate on the part of the code that does the modelling, in

Note: Before you do anything else, please try to compile and run the given code, and ask for help if you cannot get it running on your machine.

You will use Euler's method to simulate the movement of the balls. Let the balls have different sizes and weights. The equations for the movement are the following:

  • See this note with bouncing ball calculations for more details.
  • HINT: Some groups have trouble with this problem because they do not plan their problem solving and are not careful with details. First think and determine exactly what it is you need to calculate in each step, and make sure you understand what you are doing. Draw appropriate figures, define appropriate quantities etc.


    1. When your code is ready, please demonstrate your code to a supervisor. Use the topic 'Demonstrate BB' on waglys to request this.
    2. Please submit your file through FIRE by Sunday 6 September.
    3. If you have not demonstrated your code to a supervisor before Sunday, please submit your code and then demonstrate it to a supervisor next week.
    4. There is no follow-up lecture for this module, but after Sunday we will publish a note containing some questions and topics to think about during your reflection.