Monday, April 11, 2011

Some random fractals

I attached a few random fractals to improvisation videos. For that, I chose fractal plots that remind of astronomical images:

http://www.youtube.com/watch?v=H9bqspaQ84g&feature=related
http://www.youtube.com/watch?v=YYKLfx7e7tU&NR=1

Thursday, November 22, 2007

Wallpaper attractor

Hello,

Here is again a nice code
from Bernardo Rangel Tura.
#
# Wallpaper
#
#xn+1 = yn - sign(xn) | b xn - c |1/2
#yn+1 = a - xn
#
# a=1
# b=4
# c=60

wallpaper<-function(n=4E4,x0=1,y0=1,a=1,b=4,c=60){
x<-c(x0,rep(NA,n-1))
y<-c(y0,rep(NA,n-1))
cor<-rep(0,n)


for (i in 2:n){

x[i] = y[i-1] - sign(x[i-1])*sqrt(abs( b*x[i-1] - c) )
y[i] = a - x[i-1]
cor[i]<-round(sqrt((x[i]-x[i-1])^2+(y[i]-y[i-1])^2),0)
}
n.c<-length(unique(cor))
cores<-heat.colors(n.c)

plot(x,y,pch=".",col=cores[cor])

}

wallpaper()


"In this code I colored points based in velocity ..." (B.R. Tura)

Wednesday, April 25, 2007

Fractal interpolation

Iterated function system for fractal interpolation. Copy-paste and run.

http://users.utu.fi/attenka/FractInterpolation.R



Saturday, April 21, 2007

Julia and Mandelbrot

I made a video using the developed versions of the codes presented below. The quality of the video is fairly poor but the idea becomes clear. The function, which forms the successive julia sets is C=a+sin(3*a)i, (-1.5 < a < 0.5), in which C is a complex parameter for the julia set.

http://www.ag.fimug.fi/~Atte/Julia&Mandelbrot.wmv

http://www.ag.fimug.fi/~Atte/Julia&Mandelbrot.rm

Wednesday, April 18, 2007

Mandelbrot set

Very inefficient code. Takes a few minutes to compute depending on the processor speed...

http://users.utu.fi/attenka/mandelbrot_set.R

Julia set

Perhaps not the most powerful code (you have to wait a little...) but readable and it works.

http://users.utu.fi/attenka/julia_set.R







Monday, April 16, 2007

Rossler Attractor

Another code from Bernardo Rangel Tura. Thank you!

####################
#Rossler Attractor #
####################

#dx / dt = - y - z
#dy / dt = x + a y
#dz / dt = b + z ( x - c )
#
#where a = 0.2, b = 0.2, c = 5.7

rossler<-function(n=2000,a=.2,b=.2,c=1.7,x0=0.0001,y0=0.0001,z0=0.0001){
x<-c(x0,rep(NA,n-1))
y<-c(y0,rep(NA,n-1))
z<-c(z0,rep(NA,n-1))
h<-0.015
for (i in 2:n){
x[i]<-x[i-1]-h*(y[i-1]+z[i-1])
y[i]<-y[i-1]+h*(x[i-1]+a*y[i-1])
z[i]<-z[i-1]+h*(b+z[i-1]*(x[i-1]-c))
}
require(rgl)
rgl.clear()
rgl.points(x,y,z, color=heat.colors(n), size=1)
}

rossler(2000,x0=3,y0=4,z0=.4)