WOLFRAM SYSTEM MODELER

BouncingBalls2D

Bouncing balls in 2D with collision detection

Wolfram Language

In[1]:=
SystemModel["EducationExamples.Physics.BouncingBalls.BouncingBalls2D"]
Out[1]:=

Information

A number of balls are positioned in a rectangular room with walls and given initial velocities. They then bounce against each other and the walls.

Visualize

Create a custom interactive visualization of the balls in the room. Distribute the result as an interactive CDF document.

animate

Visualize the trajectory of each ball with Mathematica's ParametricPlot.

parametric

In order to get the full experience of this example, you need a desktop Wolfram Language product. A free trial download is available at www.wolfram.com/mathematica/trial/

For the full example, open the accompanying notebook BouncingBalls.nb.

Parameters (5)

g

Value: 9.81

Type: Real

Description: gravity acceleration

nr

Value: 5

Type: Integer

Description: number of balls

aInit

Value: zeros(nr, 2)

Type: Real[nr,2]

Description: initial acceleration

wallx

Value: 6

Type: Real

Description: distance along the x-axis to the wall from the center

wally

Value: 10

Type: Real

Description: distance along the y-axis to the wall from the center