# Physics

Expand the curriculum with exciting experiments in dynamics and gain insight into how modeling and simulation can enhance and strengthen understanding of physics and math concepts.

## Golf and Soccer

This example will show how you can create very different scenarios using some concepts in SystemModeler and Modelica. In this case, both a soccer kick and a golf strike are included in the same model, using something called replaceable components.

To run this example, you'll need

### Inside the sport model component are the two different models for golf and soccer. By redeclaring the top-layer sport model, you can choose which of these models to use.

By redeclaring the model you want to use, all parameters will change appropriately, with only one click.

### If you redeclare the top-layer sport model to use the soccer model, it is basically the same model as was analyzed in the Bend It Like Beckham example. If you want to see what can be done with the soccer model, check out that example! Here you can focus on what the golf model contains.

Diagram view of the golf model within the sport model component. Magnus and drag forces, as well as a visualization, are connected to a body to transform the body into a golf ball. A golf bag with different clubs is used to calculate the velocity of the ball after a strike.

User-Friendly Models

Redeclare can give drop-down choices so the user can decide what model configurations to simulate.

### The equations modeling the club hitting the ball are relatively simple and taken from the book Physics for Game Programmers. The velocity of the ball after striking is dependent on the velocity of the club at impact, the loft angle of the club, and the mass of the club and ball. To model different clubs, each club has a different club mass, loft angle, and impact velocity. To make it easy for the user to change clubs, the replaceable component Golf Bag has been implemented, with preconfigured different clubs inside.

Golf Bag component where different redeclaration choices have been made. The user can easily decide what club should be modeled.

### How does a 3 iron compare to a 9 iron? First simulate the golf model with a 3 iron and then simulate the same model with a 9 iron. This is done by just redeclaring the club in the Golf Bag component and simulating again. The loft angles for the two clubs are 21° for the 3 iron and 43° for the 9 iron. Both strikes will be identical except for the different club properties.

Ball trajectory visualized in the animation from a 3 iron.
Ball trajectory visualized in the animation from a 9 iron.

### You can analyze how the drag force and Magnus force affect the trajectory of a ball. The simplest way to see the effect of the forces is to compare the cases of a model without drag force and one with drag force, and the same for the Magnus force.

This plot shows how the trajectory changes for a 3 iron with/without drag and with/without Magnus force.

How to Cheat at Golf

If you could disable the drag force and use the Magnus effect, you would be a golf pro in no time!

### It is really easy to understand how the ball is affected by these forces, but it might be a bit difficult to grasp from just using mathematics. You could have a real advantage if you managed to shoot the ball utilizing the Magnus effect but discarding the drag. Sadly, this is impossible. However, the plot shows quite well the effect of both the decelerating drag force and the lifting Magnus force.

Flexible Modeling

Use the strength of SystemModeler and Modelica to create flexible models

## Wolfram System Modeler

Questions? Comments? Contact a Wolfram expert »