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 at saic.com ` \
Nice !! Le 04.10.2005 21:04, Tuszynski, Jaroslaw W. a ??crit :>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 at saic.com ` \ > >______________________________________________ >R-help at 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 > >-- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ ~~~~~~ Romain FRANCOIS - http://addictedtor.free.fr ~~~~~~ ~~~~ Etudiant ISUP - CS3 - Industrie et Services ~~~~ ~~ http://www.isup.cicrp.jussieu.fr/ ~~ ~~~~ Stagiaire INRIA Futurs - Equipe SELECT ~~~~ ~~~~~~ http://www.inria.fr/recherche/equipes/select.fr.html ~~~~~~ ~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~
This probably has nothing to do with your software but on my Windows XP system I just get a static image on Internet Explorer with the animated GIF but with Firefox and the same GIF the animation comes out as expected. On 10/4/05, Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI at 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 at saic.com ` \ > > ______________________________________________ > R-help at 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 >
Works well with both IE and Firefox on my 2 year old DELL WinXP machine. Charles Annis, P.E. Charles.Annis at StatisticalEngineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Gabor Grothendieck Sent: Wednesday, October 05, 2005 9:38 PM To: Tuszynski, Jaroslaw W. Cc: (r-help at stat.math.ethz.ch.) Subject: Re: [R] Animation of Mandelbrot Set This probably has nothing to do with your software but on my Windows XP system I just get a static image on Internet Explorer with the animated GIF but with Firefox and the same GIF the animation comes out as expected. On 10/4/05, Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI at 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 at saic.com ` \ > > ______________________________________________ > R-help at 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>______________________________________________ R-help at 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
Very great job 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 >-- Xiaohua Dai, Dr. [[alternative HTML version deleted]]
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.gifLoading 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]]
http://cran.r-project.org/src/contrib/Descriptions/caTools.html has current versions (1.4) of both source and binary. Jarek ====================================================\==== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation <\__,| (703) 676-4192 "> \ Jaroslaw.W.Tuszynski at saic.com ` \ -----Original Message----- From: I.Visser at uva.nl [mailto:I.Visser at uva.nl] Sent: Thursday, October 06, 2005 8:19 AM To: roger bos; Tuszynski, Jaroslaw W. Cc: (r-help at stat.math.ethz.ch.) Subject: Re: [R] Animation of Mandelbrot Set The binary version of caTools on CRAN (1.0) does not have the write.gif function but the source version (1.4) does ... hth, ingmar> From: roger bos <roger.bos at gmail.com> > Reply-To: roger bos <roger.bos at gmail.com> > Date: Thu, 6 Oct 2005 08:14:42 -0400 > To: "Tuszynski, Jaroslaw W." <JAROSLAW.W.TUSZYNSKI at saic.com> > Cc: "\(r-help at stat.math.ethz.ch.\)" <r-help at stat.math.ethz.ch> > Subject: Re: [R] Animation of Mandelbrot Set > > 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?