lemniscates



Andrej Vodopivec pisze:
> On Sun, Mar 16, 2008 at 12:06 PM, Adam Majewski <adammaj1 at o2.pl> wrote:
>> Adam Majewski pisze:
>>  ....
>>  > Can it be done better ?
>>  >
>>  > Adam

> Sometimes it takes more than just one day to get an answer ;)

(:-))
> 
> In drawing f[6] you get a bad image because of floating point error.
> You can trick implicit_plot to do computations in higher precision.

> 
> implicit_draw will draw the boundary of the region where the function
> has negative value. You can define a function f6 which computes the
> sing of f[6] using bigfloats and then plot f6:
> 
> f6(x,y):=
>  block([x:bfloat(x), y:bfloat(y)],
>    if abs(''(f[6](c)))>2 then 1 else -1)$
> fpprec:32$
> implicit_plot('(f6(x,y)), [x,-2.5,2.5], [y,-2.5,2.5]);
> 
> or all 6 curves:
> 
> implicit_plot(
>  append(makelist(abs(ev(f[n](c)))=ER,n,1,5), ['(f6(x,y))]),
>  [x,-2.5,2.5],[y,-2.5,2.5]);
> 
> HTH,
> 
Sure. It works good.

============ code ===
c: x+%i*y;
ER:2;
iMax:7;
f[n](c) := if n=1 then c else (f[n-1](c)^2 + c);
F(x,y):=block([x:bfloat(x), y:bfloat(y)],if abs(''(f[6](c)))>ER then 1 
else -1);
fpprec:32;
load(implicit_plot); /* package by Andrej Vodopivec */
ip_grid:[100,100];
ip_grid_in:[15,15];
/*implicit_plot('(f6(x,y)), [x,-2.5,2.5], [y,-2.5,2.5]); */
implicit_plot(append(makelist(abs(ev(f[n](c)))=ER,n,1,5), 
['(F(6,x,y))]),[x,-2.5,2.5],[y,-2.5,2.5]);
============end code ==========================
I have drawn curves 1-6 using your method.


and tried to do more:


======== code for curves 1-9 ========================
c: x+%i*y;
ER:2;
f[n](c) := if n=1 then c else (f[n-1](c)^2 + c);
F6(x,y):=block([x:bfloat(x), y:bfloat(y)],if abs(''(f[6](c)))>ER then 1 
else -1);
F7(x,y):=block([x:bfloat(x), y:bfloat(y)],if abs(''(f[7](c)))>ER then 1 
else -1);
F8(x,y):=block([x:bfloat(x), y:bfloat(y)],if abs(''(f[8](c)))>ER then 1 
else -1);
F9(x,y):=block([x:bfloat(x), y:bfloat(y)],if abs(''(f[9](c)))>ER then 1 
else -1);
fpprec:32;
load(implicit_plot); /* package by Andrej Vodopivec */
ip_grid:[100,100];
ip_grid_in:[15,15];
/*implicit_plot('(f6(x,y)), [x,-2.5,2.5], [y,-2.5,2.5]); */
my_preamble: "set zeroaxis; set title 'Boundaries of level sets of 
escape time of Mandelbrot set'; set xlabel 'Re(c)';  set ylabel 'Im(c)'";
implicit_plot(append(makelist(abs(ev(f[n](c)))=ER,n,1,5),['(F6(x,y))],['(F7(x,y))],['(F8(x,y))],['(F9(x,y))]),[x,-2.5,2.5],[y,-2.5,2.5],[gnuplot_preamble,my_preamble],[gnuplot_term,"png 
size 1000,1000"],[gnuplot_out_file, "lemniscates_9.png"]);
============ end code =========================

But Maxima hangs up. I will be working on it,  maybe it simple spelling 
error in code, or to heavy task for program.

 > You can trick implicit_plot to do computations in higher precision.
Yes its very "tricky". I suppose that there is no more simple ( 
intuitive ) ways to do it.
If I could dream it will be done by one instruction :
fpprec:32;

or maybe Maxima could automaticaly change precision ?
Can it be changed in Maxima ?

Thx.

Adam