Appendix D: The Mathematica Commands

In this appendix, we will translate the primary Maple commands we used throughout the book to Mathematica version 5.2. Any later version of Mathematica will work in the same way.

D.1 The Upper and Lower Values of a Game

We begin by showing how to use Mathematica to calculate the lower value

Unnumbered Display Equation

and the upper value

Unnumbered Display Equation

of the matrix A.

Enter the matrix

A={{1, 4, 7}, {-1, 3, 5}, {2, -6, 1.4}}
rows = Dimensions[A][[1]]
      cols = Dimensions[A][[2]]
        a = Table[Min[A[[i]]], {i, rows}]
          b = Max[a[[]]]
            Print["The lower value of the game is= ", b]
            c = Table[Max[A[[All, j]]], {j, cols}]
              d = Min["c[[]]]
              Print["The upper value is=", d]

These commands will give the upper and lower values of A. Observe that we do not need to load any packages and we do not need to end a statement with a semicolon. On the other hand, to execute a statement we need to push Shift + Enter at the same time.

D.2 The Value of an Invertible Matrix Game with Mixed Strategies

The value and optimal strategies of a game with an invertible matrix (or one which can be made invertible by adding a constant) are calculated in the following. The formulas we use are as follows:

Unnumbered Display Equation

and

If these are legitimate ...

Get Game Theory: An Introduction, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.