Bill Allombert on Wed, 15 Feb 2017 13:14:02 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Can use PariGp to generate fractals over the real line?


On Wed, Feb 15, 2017 at 08:37:35AM -0300, Sec Munic wrote:
> May PariGp be used to generate fractals over the real line?
> 
> I want to specify a Hausdorff dimension n, and generate a fractal with
> dimension n=log(b^n)/log(b).
> The fractal is generated by starting with the interval [0,r] and
> iteratively dividing it in b parts,and deleting the last (b-b^n) parts
> (0<n<1)

You can try this:
fr(b,k,eps,int)=
{
  if(int[2]-int[1]<eps,
    [int],
    concat(vector(b-k,i,my(a=int[1],l=int[2]-int[1]);
      fr(b,k,eps,[a+(i-1)/b*l,a+i/b*l]))))
}
draw(V)=
{
  plotinit(1);
  for(i=1,#V,
    plotmove(1,V[i][1],50);
    plotrline(1,V[i][2]-V[i][1],0));
  plotdraw([1,0,0])
}

draw(fr(5,1,1,[100,600]))

> I cannot figure what would happen when -1<n<0  (the dimension is negative),
> so I want to see what the algorithm does.

Let k = (b-b^n) the number of parts you delete, then n = log(b-k)/log(b)
if n<0 then this implies that b and k cannot be both integers.
(the logarithm of a positie integers is positive)

So how do you delete a fractional part ?

Cheers,
Bill.