Hard to say.  You might want to run a profile of each set of code and see
where it is spending its time.  It looks like from the R code that they are
using vectorized operations and depending on how some of them are
implemented, they might be calling C code to do most of the work.  With the
proper use of vectorized operations, R can be pretty fast.

I don't understand CAS code, but it looks like there is a lot of iteration,
and function calls, that might be adding to the time.  Profiling will help
you localize the issues.

On Tue, Mar 9, 2010 at 4:49 PM, Adam Majewski <adammaj1@o2.pl> wrote:

> 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
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

	[[alternative HTML version deleted]]

