lisp or draw error



Adam Majewski escribi?:
> Hi,
> 

Hello,

With my maxima + clisp I reached an overflow before arriving to draw:

> /* define function ( map) for dynamical system z(n+1)=f(zn,c)  */
> f(z,c):=z*z+c;
> 

If you redefine temporarily function f this way:

f(z,c):=(print(abs(z)), expand(z*z+c));

you'll see how fast the z values grow when you execute this part of your 
code (by the way, you can remove word 'block' safely):

> z:zcr; /* first point  */
> orbit:[z];
> for i:1 thru iMax step 1 do
> block
> (
>    z:f(z,c),
>    orbit:endcons(z,orbit)
>    /* disp(rectform(orbit[i])) */
> );

(%i89) f(z,c):=(print(abs(z)), expand(z*z+c));
(%o89)            f(z, c) := (print(abs(z)), expand(z z + c))
(%i90) z:zcr; /* first point  */
(%o90)                                 0
(%i91) orbit:[z];
(%o91)                                [0]
(%i92) for i:1 thru iMax step 1 do
block
(
    z:f(z,c),
    orbit:endcons(z,orbit)
    /* disp(rectform(orbit[i])) */
);
0
1.001
.7258378668048976
1.172379517758521
1.778440378459839
2.766739741404682
8.042380552955356
65.66672716487469
4311.200010268945
1.8586445514385425E+7
3.454559568592188E+14
1.193398181295185E+29
1.424199219118654E+58
2.02834341573818E+116
Maxima encountered a Lisp error:


floating point overflow

----------------------------

In my opinion, you should make a greater control on the orbit to avoid 
overflows.

Some time ago I wrote a small maxima function for generating Julia sets. 
After that, I rewrote the same algorithm in Lisp, making use of Lisp 
complex numbers. The Lisp code runs 60 times faster. If you are 
interested I can look for it tomorrow... I have not time at this moment, 
since I'm going to watch a football match ;-)

-- 
Mario Rodriguez Riotorto
http://www.telefonica.net/web2/biomates