WOLFRAM SYSTEM MODELER
BouncingBalls2DBouncing balls in 2D with collision detection |
SystemModel["EducationExamples.Physics.BouncingBalls.BouncingBalls2D"]
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.
Create a custom interactive visualization of the balls in the room. Distribute the result as an interactive CDF document.
Visualize the trajectory of each ball with Mathematica's ParametricPlot.
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.
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 |