MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Box counting dimension for fractals via Mathematica??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2712] Re: Box counting dimension for fractals via Mathematica??
  • From: Pasquale Nardone <pnardon at ulb.ac.be>
  • Date: Sat, 9 Dec 1995 01:54:23 -0500
  • Organization: Universitiso-8859-1 Libre de Bruxelles

you don't need a package,
try this function:

BoxCount[list_,delta0_,scale_,min_]:=
Block[ {tmp,delta,nmax,l,i},
tmp={};
delta=delta0;
nmax=Abs[Ceiling[Log[min/delta0]/Log[scale]]];
Do[
{
l=Length[Complement[Ceiling[list/delta],{}]];
AppendTo[tmp,{delta,l}];
delta=delta*scale}, {i,1,nmax}];
Return[tmp]];
_____________
list: is your original liste
delta0: is the first box size
scale: is the factor which scale the box size
min: is the minimum value for the box size
_____________
BoxCount: return a list of list
{{size of the box, number of points in the box},...}
_____________
for example:
data=Table[{Random[Real,{0,1}],Random[Real,{0,1}]},{1000}];
(* generate random data in 2D *)
In[2] 
res=BoxCount[data,1.0,0.51,0.001]
Out[2]
Out[49]=
{{1., 1}, {0.51, 4}, {0.2601, 16}, {0.132651, 64}, {0.067652, 223}, {0.0345025, 582}, 
{0.0175963, 862}, {0.00897411, 960}, {0.00457679, 988}, {0.00233417, 996}, 
{0.00119042, 997}}
_______
after that you can plot the result via a log-log graphics
or compute the box dimension by fitting

qqq[{x_,y_}]:=N[{-Log[10,x],Log[10,y]}]

res2=Map[qqq,res]

ListPlot[res2,PlotJoined->True,PlotRange->All,
Frame->True]

In[53]:=
Fit[Take[res2,6],{1,x},x]
Out[53]=
0.0495925 + 1.92138 x
--------------------------------------------
 Pasquale Nardone                          *
                                           *
 Universiti Libre de Bruxelles             *
 CP 231, Sciences-Physique                 *
 Bld du Triomphe                           *
 1050 Bruxelles, Belgium                   *
 tel: 650,55,15 fax: 650,57,67 (+32,2)     *
        ,,,
       (o o)
----ooO-(_)-Ooo----


  • Prev by Date: question on caching
  • Next by Date: Re: HELP! Memory problem?
  • Previous by thread: Box counting dimension for fractals via Mathematica??
  • Next by thread: Isomorphic Graphs