# Mathematical Models and Applications

This is a ungraduate/graduate level course being offered at Indiana University by the Math Department. I took this course on Fall 2014 with Prof. Andrew Dabrowski. The textbook we used was: Mathematical Modeling and Computer Simulation by Maki and Thompson, a really cool and easy book to get your feet wet with computer simulation, I highly recommend it. All the assignments are from the book. The following is a compilation of my solutions to assignments given in class.

## Assignments

- Assignment 1 (with solutions)
- Assignment 2 (with solutions)
- Assignment 3 (with solutions)
- Assignment 4 (with solutions)
- Assignment 5 (with solutions)
- Assignment 6 (with solutions)
- Flip Coin Simulator (code in PhP)

## Exams

- Practice Exam 1 (no solutions provided)
- Exam 1 - [Solutions]
- Practice Exam 2 (no solutions provided)
- Exam 2 - [Solutions]
- Practice Final Exam (no solutions provided)

## Resources

## Simulation Project: FIFA WORLD CUP SIMULATOR

This is the project that I created for this class. The following is a summary of the project.

Founded in 1930, the FIFA World Cup is the world’s most important soccer competition. Held every 4 years, teams from many countries around the world compete for as early as 2 years before the competition for one place of only 32 available. Teams are divided in 8 groups that compete in two phases: group stage and knockout. The knockout consists of a Round of 16, then quarterfinals, semifinals and the finals. The finals of the FIFA World Cup is the most widely viewed sporting event with an estimated of 715.1 million people watching the FIFA 2006 final match.

The purpose of this simulation is to explore the dynamics of the competition and how its structure affects its outcome. The input of the simulation consists of a list of 32 teams, each with a ranking assigned by FIFA from which a probability of winning a single match is determined. The simulation will take this list and randomly assigned teams to 8 groups (Groups A, B, C, ..., H) just like in the real competition. Teams are ranked according to their probabilities of winning a single match and hence, the 8 best teams are those with the highest winning probability. The best 8 teams act as seeds and are placed in eight different groups while the rest of the teams are placed in any group randomly.

Next, the group stage is simulated. A team plays exactly once against teams in its group for a total of 3 games. Points are awarded as follow: 3 points for a victory, 1 point for a draw and 0 points for a defeat. After all games are played, only the first two teams on each group move on to the knockout phase starting with the Round of 16. In this and subsequent phases elimination from the competition is direct based on one game. The setup of the Round of 16 follows the structure: 1A2B (where 1A means the first team on group A plays the second of group B), 1C2D, 1E2F, 1G2H, 1B2A, 1D2C, 1F2E and 1H2G. Subsequent phases follow a similar structure.

Goals

The idea of this project is that, for given ranking of teams, run many simulations of the tournament and answer the following questions:

- How many times does the favorite (least) team (where the favorite (least) team is that with the highest (lowest) ranking ) actually win the tournament? Mathematically, if we let X = number of times the favorite (least) team wins, then we want to estimate values for E[X] and Var[X].
- How many times does the favorite (least) team is at least third? Similarly, we can ask for expected value and variance for these random variables.
- How many tournaments should we wait until the favorite (least) team wins?

If you are interested in this project you can download the following files:

- Documentation and Results
- Entire Code (written in Java)
- Or you can also check out the GitHub Repository for this project.