This example computes a table of the power of the χ2
test at the 5%
significance level, for various degrees of freedom and non-centrality
parameters. The table is deliberately the same as Table 6 from "The
Non-Central χ2 and F-Distributions and their applications.", P.
B. Patnaik, Biometrika, Vol. 36, No. 1/2 (June 1949), 202-232.

First we need some includes to access the non-central chi squared
distribution (and some basic std output of course).

The output from this program is a table in Boost.Quickbook format
as shown below.

We can interpret this as follows - for example if ν=10 and λ=10 then
the power of the test is 0.542 - so we have only a 54% chance of
correctly detecting that our null hypothesis is false, and a 46%
chance of incurring a type II error (failing to reject the null hypothesis
when it is in fact false):