[R] speed

Adam Majewski adammaj1 at o2.pl
Tue Mar 9 22:49:24 CET 2010


Hi,

I have found some example of R code :
http://commons.wikimedia.org/wiki/File:Mandelbrot_Creation_Animation_%28800x600%29.gif

When I run this code on my computer it takes few seconds.

I wanted to make similar program in Maxima CAS :

http://thread.gmane.org/gmane.comp.mathematics.maxima.general/29949/focus=29968

for example :

f(x,y,n) :=
 block([i:0, c:x+y*%i,ER:4,iMax:n,z:0],
 while abs(z)<ER and i<iMax
    do (z:z*z + c,i:i+1),
 min(ER,abs(z)))$

wxanimate_draw3d(
    n, 5,
    enhanced3d=true,
    user_preamble="set pm3d at b; set view map",
    xu_grid=70,
    yv_grid=70,
    explicit('f(x,y,n), x, -2, 0.7, y, -1.2, 1.2))$


But it takes so long to make even one image ( hours)

What makes the difference, and why R so fast ?

Regards

Adam



More information about the R-help mailing list