Numerical Integration Using Simpson's Method

Before we get started with the mathematics, let's agree on what we want to achieve. The purpose of the work done in this Appendix to Part 3 is to find the answer to the following question:*What is the area under the curve of a flop equity distribution graph between 0 and top x% of flops?*

For example, we pit KKxx against AAxx and ask: *On what percentage of flops does KKxx have minimum 50% equity against AAxx?*. We look at the graph and find the answer to be top 19% of flops, as shown below::

Then we ask: *What is the area under the curve between 0 and top 19% of flops?* This is the colored area shown on the figure below:

Now we'll compute this area using a technique called "Simpson's Method" (not Homer):

Computing the area under a curve using Simpson's Method

Computing the area A{a, b} under a curve on an interval {a, b} (for example, the area under a flop equity distribution curve between x =0 and x =1) can be done approximately using Simpson's formula:

A{a, b} =(1/6)(b-a){f(a) + 4f((a-b)/2) + f(b)}

Where

f(a) =the value of the curve at the starting point a

f(b) =the value of the curve at the endpoint b

(a-b)/2 =the midpoint between a and b

f((a-b)/2) =the value of the curve at the midpoint

To show how this is done, let's compute the total area under the flop equity distribution curve for KKxx vs AAxx. When we discussed flop equity distributions previously in Part 3, we stated that the total equity of KKxx versus AAxx is equal to the total area under the flop equity distribution curve. Using ProPokerTools we know that this equity is 30.16% (ProPokerTools calculation), so the area under the curve is 0.3016 as shown below:

Now we'll use this exact number as a test of the accuracy of Simpson's method. We'll compute the area under the curve between 0 and top 100% of flops (e.g. between x =0 and x =1) and compare our answer to the exact answer.

Since our curve segment is the whole curve, we are working on a large interval {0, 1}. So in order to increase our accuracy, we'll split the interval into 10 sub-intervals {0, 0.10}, {0.10, 0.20}, ..., {0.90, 1.00} (the smaller the interval we're working in, the more accurate Simpson's method becomes). We'll compute the area for each sub-interval, and then we sum them to find the total area.

We start with the first interval {0, 0.10}. First we read the value (y) of the curve at the starting point x =0, then at the endpoint x =0.10, and then at the midpoint x =(0.10 - 0)/2 =0.05. We do this manually, and with some practice it should be possible to obtain an accuracy of +/- 0.005:

x =0.000 y =1.000

x =0.050 y =0.900

x =0.100 y =0.845

We plug these numbers into Simpson's formula, and get:

A{0, 0.10}

=(1/6)(0.10 - 0.00){1.000 + 4(0.900) + 0.845}

=0.0908

So the area under the curve between x =0 and x =0.10 is 0.0908. Then we compute the areas of the other sub-intervals A{0.10, 0.20}, A{0.20, 0.30}, ..., A{0.90, 1.00} in a similar way. Below are all the necessary data x and y for all the data points we need. Further below are the computed areas:

x =0.000 y =1.000

x =0.050 y =0.900

x =0.100 y =0.845

x =0.150 y =0.630

x =0.200 y =0.475

x =0.250 y =0.405

x =0.300 y =0.325

x =0.350 y =0.290

x =0.400 y =0.265

x =0.450 y =0.230

x =0.500 y =0.200

x =0.550 y =0.175

x =0.600 y =0.155

x =0.650 y =0.145

x =0.700 y =0.130

x =0.750 y =0.120

x =0.800 y =0.100

x =0.850 y =0.085

x =0.900 y =0.055

x =0.950 y =0.025

x =1.000 y =0.000

A{0.00, 0.10} =0.0908

A{0.10, 0.20} =0.0640

A{0.20, 0.30} =0.0403

A{0.30, 0.40} =0.0292

A{0.40, 0.50} =0.0231

A{0.50, 0.60} =0.0176

A{0.60, 0.70} =0.0144

A{0.70, 0.80} =0.0118

A{0.80, 0.90} =0.0083

A{0.90, 1.00} =0.0026

The total area under the curve is:

A{0.00, 1.00}

=0.0908 + 0.0640 + 0.0403 + 0.0292 + 0.0231 + 0.0176 + 0.0144 + 0.0118 + 0.0083 + 0.0026

=0.3020

This is almost identical with the exact answer (0.3016). We conclude that Simpson's formula gives us more than sufficient accuracy for computing the area under a curve.

Then, finally, we'll find the area under the curve between 0 and top 19% of flops, which we have used as an example. We compute this number using the following division of the interval {0.10, 0.19} into sub-intervals:

{0, 0.10}, {0.10, 0.19}

x =0.000 y =1.000

x =0.050 y =0.900

x =0.100 y =0.845

x =0.145 y =0.640

x =0.19 y =0.500

And Simpson's formula gives us:

A{0.00, 0.10} =0.0908

A{0.10, 0.19} =0.0586

The total area between 0 and top 19% of flops is therefore:

A{0, 0.19}

=0.0908 + 0.0586

=0.149

This is the total equity that KKxx has on it's top 19% of flops against AAxx. The

*average*equity on these flops is found by simply dividing the total equity found on these flops on the length of the interval (which is 19% - 0% =0.19 - 0 =0.19):

Average equity

=0.149/0.19

=0.784

=78.4%

We now have the necessary mathematical tools to compute average equity on top x% of flops for one hand/range against another hand/range, and we will use these tools in future work.