Re: [R] Animation of Mandelbrot Set

From: roger bos <roger.bos_at_gmail.com>
Date: Thu 06 Oct 2005 - 22:14:42 EST

Anyone know why I would get an Error: couldn't find function "write.gif" despite loading library(caTools) with no errors in R 2.1.1 under XP?  Thanks,
 Roger
 > library(fields) # for tim.colors
fields is loaded use help(fields) for an overview of this library
> library(caTools) # for write.gif
Loading required package: bitops
> m = 400 # grid size
> C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
+ imag=rep(seq(-1.2,1.2, length.out=m), m ) )
> C = matrix(C,m,m)
> Z = 0
> X = array(0, c(m,m,20))
> for (k in 1:20) {

+ Z = Z^2+C
+ X[,,k] = exp(-abs(Z))
+ }

> image(X[,,k], col=tim.colors(256)) # show final image in R
> write.gif(X, "Mandelbrot.gif", col=tim.colors(256), delay=100)
Error: couldn't find function "write.gif"

 On 10/4/05, Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI@saic.com> wrote:
>
> Hi,
>
> I was playing with Mandelbrot sets and come up with the following code, I
> thought I would share:
>
> library(fields) # for tim.colors
> library(caTools) # for write.gif
> m = 400 # grid size
> C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
> imag=rep(seq(-1.2,1.2, length.out=m), m ) )
> C = matrix(C,m,m)
> Z = 0
> X = array(0, c(m,m,20))
> for (k in 1:20) {
> Z = Z^2+C
> X[,,k] = exp(-abs(Z))
> }
> image(X[,,k], col=tim.colors(256)) # show final image in R
> write.gif(X, "Mandelbrot.gif", col=tim.colors(256), delay=100)
> # drop "Mandelbrot.gif" file from current directory on any web brouser to
> see the animation
>
> Jarek
> ====================================================\====
> Jarek Tuszynski, PhD. o / \
> Science Applications International Corporation <\__,|
> (703) 676-4192 "> \
> Jaroslaw.W.Tuszynski@saic.com ` \
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 06 22:18:14 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:36 EST