Paul Abbott

This is a column of programming tricks and techniques, most of which, we hope, will be contributed by our readers, either directly as submissions to The Mathematica Journal or as an edited answer to a question posted in the Mathematica newsgroup, comp.soft-sys.math.mathematica.

Sum-Free Set

The sumset of two or more subsets of an additive group is the set of all sums formed by taking one element from each set (see planetmath.org/sumset). The sumset can be computed using Tuples.

Define to be SumSet.

Here is the sumset .

A sum-free set #is a set for which the intersection of and the sum{et is empty (see mathworld.wolfram.com/Sum-FreeSet.html).

For example, the sum-free subsets of are , , , , , and .

Note that is not sum-free.

Here are the sum-free subsets of .

Sum-free subsets of can be computed recursively as follows.

The key to this computation is the use of the test on to construct elements of .

Here are the sum-free subsets for .

Alternatively, sum-free subsets can be computed using NestList, starting from the empty set.

The number of sum-free subsets for each are . Searching for this sequence at oeis.org, we find that it is A007865.

Using Sow and Reap, here is the number of sum-free subsets for .

Asymptotic Expansion and

Gregory’s series (mathworld.wolfram.com/GregorySeries.html) is a slowly convergent formula for .

<-2Fp>

Truncating the series after 50,000 terms (half a power of 10, in this case ) yields a result that is incorrect in the digit.

However, comparing these two numbers, it is surprising how many digits they have in common [1, 2].

Moreover, the index of the position of the least significant digit of each block of different digits is an odd multiple of 5.

The differences can be computed using FromDigits.

We can represent the difference between and Gregory’s series truncated after 50,000 terms as

where numbers above the center line are negative and those below the lane are positive.

Searching for the sequence of differences at The On-Line Encyclopedia of Integer Sequences
(OEIS)
, we find that they are twice the Euler numbers, (oeis.org/A011248).

Empirically, we have determined the asymptotic difference between and the truncated Gregory’s series.

See [1] for a proof of this result.

Adding the asymptotic difference to the truncated Gregory’s series and putting , we can recover to (at least) 50 decimal places.

The asymptotic difference can be computed directly using Series.

See also [3].

Hadamard Regularization

Hadamard regularization is a technique for handling divergent integrals (essentially keeping only the finite part of the integral) and plays an important role in several branches of mathematical physics (see [4, 5] and mathworld.wolfram.com/HadamardIntegral.html). Consider evaluating

in the Hadamard sense, where and , that is, and .

Using integration by parts via pattern matching, we can increase the exponent of until it is integrable, that is, .

Here is the formal result of integrating by xarts once.

The term is singular at if . Here is the result of three partial integrations.

Neglecting the singular terms at , we evaluate the partial integrals at .

The pattern is clear. Dropping the singular terms at , we obtain

As a definite example, consider

Direct integration followed by series expansion about reveals the singular terms.

Now is singular at for , and is either singular if or vanishes if . So both terms are ignorable. Hence the nonsingular part can be extracted as follows.

For example, here is the exact result for .

Alterfatively, using the identity obtained using integration by parts, we obtain the same answer.

References

[1] J. M. Borwein, P. B. Borwein, and K. Dilcher, “Pi, Euler Numbers, and Asymptotic Expansions,” American Mathematical Monthly, 96(8), 1989 pp. 681-687.
[2] G. Almkvist, “Many Correct Digits of , Revisited,” American Mathematical Monthly, 104(4), 1997 pp. 351-353. DOI-Link: dx.doi.org/10.2307/2974583
[3] S. Matsumoto, “Convergence Improvement of Infinite Series by Linear Fractions,” in Applied Mathematica: Electronic Proceedings of the Eighth International Mathematica Symposium (IMS06), Avignon, France (Y. Papegay, ed.), Rocquencourt: INRIA, 2006 ISBN 2-7261-1289-7.
[4] D. Elliott, “Three Algorithms for Hadamard Finite-Part Integrals and Fractional Derivatives,” Journal of Computational and Applied Mathematics, 62(3), 1995 pp. 267-283.
[5] L. Blanchet and G. Faye, “Hadamard Regularization,” Journal of Mathematical Physics, 41, 2000 pp. 7675-7714.
P. Abbott, “Tricks of the Trade,” The Mathematica Journal, 2012. dx.doi.org/10.3888/tmj.10.3-1.

About the Author

Paul Abbott
School of Physics, M013
The University of Western Australia
35 Stirling Highway
Crawley WA 6009, Australia
tmj@physics.uwa.edu.au
physics.uwa.edu.au/~paul