Volume 148, number 1,2 PHYSICS LETTERS A 6 August 1990 An optimized box-assisted algorithm for fractal dimensions Peter Grassberger Physics Department, University of Wuppertal, Gauss-Strasse20, D-5600 Wuppertal 1, FRG Received 8 January 1990; revised manuscript received 4 June 1990; accepted for publication 5 June 1990 Communicatedby A.P. Fordy We present an optimized algorithm for estimating the correlation dimension of an attractor based on very long time sequences. The main idea is to use a mesh in order to count only near neighbours in the correlation sum. Using linked lists, this leads to an extremely fast and storage-efficient routine, with running time and storage both cc N, for N data points and N actually computed distances. In the most straightforward implementation, es- in the box, and then scanning through these arrays. timating the correlation dimension [1,2] of an at- The drawback of this implementation which renders tractor from a time sequence of length N needs a time it practically useless is that the number of points per of order N 2 This time is further enhanced if the es- box is unknown a priori, and assigning a maximal timate is to be made not only for a single embedding number of Nelements per box would need enormous dimension, but for an entire range. Thus, even on storage. In view of this, compromises had to be made modern supercomputers, analysing time sequences in ref. [31, leading to a slightly suboptimal algo- of length N> 10~ becomes non-trivial. On worksta- rithm. Nevertheless, with it the author of ref. [3] was tions or minicomputers, a practical limit is reached able to analyse 64000 iterations of the Hénon map somewhere near N~ (1—5) X l0~. This represents a (x, y)—+(l +0.3y— l.4x2, x) in 36 mm on an IBM serious limitation, for instance in electronic experi- PC with 4.77 MHz. Compared to the naive algo- ments, in EEG observations, or in seismic data in rithm, this represents a speed-up by a factor > 1000. particular since one would like to perform dimen- An alternative to using boxes (or “radices”, as they sion estimates routinely on large numbers of time are called in ref. [4]) are trees. Among computer sequences. scientists, there exists a wide-spread opinion that As was pointed out by Theiler [3], the naive im- balanced k-d trees are optimal for searching close plementation alluded to above is highly non-opti- neighbours in k-dimensional Euclidean space [5,6]. mal. In estimating a dimension, one is only inter- An algorithm using such k-d trees for estimating the ested in close pairs of points in the time series. The correlation dimension was presented in ref. [7]. It straightforward implementation does this by first seems that this algorithm is highly optimized, at least computing all distances, and then simply discarding as far as the neighbour search is concerned, and the information contained in pairs which are not within the class of algorithms using k-d trees. close. In ref. [3] an algorithm is given which helps It is the purpose of the present note to show that in finding pairs with distance <E only, by using a an optimized box-assisted algorithm can be faster mesh of boxes. The size of each box is just ~, and than the algorithm of ref. [3], and much faster than candidates for close pairs are sought only in neigh- that of ref. [7]. At the same time it is rather simple bouring boxes, and compact. While we shall present numerical re- The most straightforward implementation of this sults for the Hénon map only, we have applied it also would consist in defining an array for each box, to lattices of coupled logistic maps [81. In this case, whose elements are just the coordinates of the points we went up to embedding dimension 15, with no loss 0375-96o1/90/$ 03.50 © 1990 Elsevier Science Publishers B.V. (North-Holland) 63