public void CombineWithAddOperator_AsExpected()
        {
            BasisFunction[] basisFunctions = BasisFunctionsBuilder.Ones +
                                             Spot + Spot * Spot + Spot * Spot.Pow(3) + X0 + X1.Pow(3) + S * X2.Pow(4);

            Assert.Equal(7, basisFunctions.Length);

            var spotPriceSims = new[] { 25.69, 21.88, 16.78 };
            var markovFactors = new ReadOnlyMemory <double>[]
            {
                new[] { 0.56, 0.12, 1.55 },
                new[] { 1.08, 2.088, 0.988 },
                new[] { 2.808, 0.998, 5.84 }
            };

            // 1s
            AssertBasisFunction(basisFunctions[0], spotPriceSims, markovFactors, new[] { 1.0, 1.0, 1.0 });
            // Spot price
            AssertBasisFunction(basisFunctions[1], spotPriceSims, markovFactors, spotPriceSims);
            // Spot price squared
            AssertBasisFunction(basisFunctions[2], spotPriceSims, markovFactors, spotPriceSims.Select(s => s * s));
            // Spot price to power of 4
            AssertBasisFunction(basisFunctions[3], spotPriceSims, markovFactors, spotPriceSims.Select(s => s * s * s * s));
            // First factor
            AssertBasisFunction(basisFunctions[4], spotPriceSims, markovFactors, markovFactors[0].ToArray());
            // Second factor cubed
            AssertBasisFunction(basisFunctions[5], spotPriceSims, markovFactors, markovFactors[1].ToArray().Select(x => x * x * x));
            // Spot price times third factor to power of 4
            double[] thirdFactor = markovFactors[2].ToArray();
            AssertBasisFunction(basisFunctions[6], spotPriceSims, markovFactors,
                                spotPriceSims.Select((s, i) => s * Math.Pow(thirdFactor[i], 4)));
        }