Friday, April 13, 2007

Modern graphic art (for some business)

ARE YOU ALSO A POOR ARTIST?

If you do, load the R-program (http://www.r-project.org/), run the next script in R, select the best pictures and print them, use your signature and organize an art exhibition. Sell your pictures. Don't reveal the coefficients so that the pictures remain unique.


If you want to be more modern, change the number in the first loop to 1000000 (I mean "g in 1:1000000"), put your computer screen to showcase and let the people enjoy (remember to turn off the screen saver, they don't look as nice). Ask the owner of the store to give
you some royalties. When you are a millionaire, remember my children too!



























P.S. Perhaps somebody can do a screensaver based on this kind of code? Only the b/w-colors must be inverted.

###################

# Random fractals #
###################
# I think there is something interesting approximately in every 50th picture ...

BMatAll=c()
for(g in 1:300)
{
# The coefficients for the iterated function system is randomly selected here. You can play with the coeff's changing the numbers here: seq(-2/3,2/3,by=1/3):

BMat=array(sample(seq(-2/3,2/3,by=1/3),24,replace=TRUE),dim=c(4,6))

# If you want to save the coefficients... and make the best pictures again.
BMatAll=c(BMatAll,BMat)

# Initial coordinates:
x=0
y=0
x1=c();y1=c()
# The code in this first loop is only for finding the limits of the picture coordinates:
for(i in 1:1000)
{
x2=x
i=sample(1:4,1,prob=c(0.7,0.1,0.1,0.1))
x=BMat[i,1]*x+BMat[i,2]*y+BMat[i,5]
y=BMat[i,3]*x+BMat[i,4]*y+BMat[i,6]
x1=c(x1,x);y1=c(y1,y)
}

# If you want to save your pictures...
# For linux: DIRECTORY="/home/user/"
# For OSX: DIRECTORY="/Users/usernameorsomething/"
# For windows: DIRECTORY="d:/RANDOMFRACTALS/"

# To earn money with your pictures, change here width=2400, height=3200, and in the next j-loop: "for(j in 1:200000)".
#jpeg(filename=paste(DIRECTORY,"RandFract",g,".jpeg",sep=""), width=600, height=800, pointsize = 12, quality = 99, bg = "white", res = NA)

plot(0,0,xlim=c(min(x1),max(x1)),ylim=c(min(y1),max(y1)),col="white")

for(j in 1:20000)
{
x3=x
i=sample(1:4,1,prob=c(0.7,0.1,0.1,0.1))
x=BMat[i,1]*x+BMat[i,2]*y+BMat[i,5]
y=BMat[i,3]*x3+BMat[i,4]*y+BMat[i,6]
points(x,y,pch=".",cex=1)
}

#dev.off() # if you want to save your pictures...
}