tennis_matrix


tennis_matrix, a Python code which computes the transition matrix for a game of tennis, which has 17 distinct states.

The peculiar tennis scoring system goes 0, 15, 30, 40, Win. However, to win, a player must be ahead by two points.

There are three "peculiar" states: Deuce, Ahead 1, Behind 1, which arise when one player is near to winning. 'Ahead 1' means the player is 1 point away from winning. 'Behind 1' means the player is 1 point away from losing. 'Deuce' means either player will win with two unopposed points.

This code assumes that the server has a constant probability p of scoring each point. The transition matrix can be used to model a particular game, given the value of p. Eigenvalue analysis or numerical simulation can then predict the likelihood that the server will win. Estimates can be made for the number of serves required in a complete game.

Licensing:

The computer code and data files made available on this web page are distributed under the MIT license

Languages:

tennis_matrix is available in a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

jordan_matrix, a Python code which returns a random matrix in Jordan canonical form.

levenshtein_matrix, a Python code which returns the Levenshtein distance matrix defined by two strings.

magic_matrix, a Python code which computes a magic matrix, for any odd order n, such that all rows and columns have the same sum.

monopoly_matrix, a Python code which computes the adjacency and transition matrices for the game of MONOPOLY.

plasma_matrix, a Python code which sets up a matrix associated with a problem in plasma physics.

risk_matrix, a Python code which computes the transition and adjacency matrix for the game of risk.

snakes_matrix, a Python code which computes the transition matrix for Snakes and Ladders.

test_matrix, a Python code which defines test matrices for which the condition number, determinant, eigenvalues, eigenvectors, inverse, null vectors, P*L*U factorization or linear system solution are known. Examples include the Fibonacci, Hilbert, Redheffer, Vandermonde, Wathen and Wilkinson matrices.

usa_matrix, a Python code which defines the adjacency matrix for US states, using a variety of matrix formats.

wathen_matrix, a Python code which compares storage schemes (full, banded, sparse triplet, sparse) and solution strategies (A\x, linpack, conjugate gradient (CG)) for linear systems involving the Wathen matrix, which can arise when solving a problem using the finite element method (FEM).

web_matrix, a Python code which stores sample matrices describing a web page network. These matrices are typically very sparse, and the examples here are stored using the sparse triplet (ST) format. They can be used to demonstrate pagerank and other graph algorithms.

wishart_matrix, a Python code which produces sample matrices from the Wishart or Bartlett distributions, useful for sampling random covariance matrices.

Reference:

  1. James Sandefur,
    A Geometric Series from Tennis,
    College Mathematics Journal,
    Volume 36, Number 3, May 2005, pages 224-226.
  2. Ian Stewart,
    Game, Set, and Math,
    Penguin, 1989.

Source Code:


Last modified on 23 December 2022.