十二 172009
A fractal is “a rough or fragmented geometric shape that can be split into parts, each of which is (at least approximately) a reduced-size copy of the whole,”a property called self-similarity. Roots of mathematical interest in fractals can be traced back to the late 19th Century; however, the term “fractal” was coined by Benoît Mandelbrot in 1975 and was derived from the Latin fractus meaning “broken” or “fractured.” A mathematical fractal is based on an equation that undergoes iteration, a form of feedback based on recursion.
(form Wikipedia)
分形几何是几何学中的新分支,其维数可以是任意值。分形图形的一个重要特点是自相似性,据此性质可以人工构造出很多养眼的图片,这里给出四种常见的分形图。更多代码和讨论请移步COS论坛。
1. 树叶
plot.leaf <- function(n=50000, col="green",cex=2){
x <- c(.5, .5);
plot(x[1], x[2], xlim=c(-3, 3), ylim =c(0, 10),type="n",xlab="",ylab="")
p <- c( .85, .92, .99, 1.00);
A <- rbind(c(.85, .04), c(-.04,.85), c(.20,-.26), c(.23,.22),
c(-.15,.28), c(.26,.24), c(0, 0), c(0, .16))
B <- cbind(c(0, 1.6), c(0, 1.6), c(0,.44), c(0,0))
for (i in 1:n){
ran <- runif(1);
ind <- rank(c(p, ran), ties.method="min")[5]
x <- A[(2*ind-1):(2*ind),]%*%x + B[,ind]
points(x[1],x[2], pch=".", cex=cex, col=col)
}
}
#library(Cairo)
#CairoPNG()
par(mar=c(0,0,0,0)+0.1)
plot.leaf(cex=1.6)
box()
#dev.off()

2. 树

3. 三角

4. 雪花

从一粒沙中,可以看到整个世界。:)
一粒沙里一个世界,一朵花里一个天堂。把无限放在你的手掌上,永恒在一刹那里收藏。(威廉·布莱克《天真的预示》 )
真的有这个味道哎
不错不错,留个纪念,可能以后会用到
你们马上就要做这个作业了,你多设计几个啊~
记得给我一份R版本的
R代码的背景和颜色很不错
我就需要这样的
快跟我说说是怎么弄的!~
这个是wordpress的一个插件CodeColorer,调用 http://qbnz.com/highlighter/index.php 来进行高亮的,其实这个网站是支持R代码高亮的,但是插件里还是不行,因此,我把R代码以ruby代码形式来进行高亮,效果还不是很好~
祥云,我回到广东了,离你特近……
这些分形到底用在什么地方?
怪不得我觉得南边的引力突然大了很多呢
你们放假了吧,我们也早放了,不过我还蜗居在学校~分形我都是拿来玩玩。没想到能用在哪里呢,不过肯定有用的
我总觉得这分形暗藏玄机~~
你底下那个blogroll也太能泄露秘密了……
大家都是行得正、走得直,没有什么的。要不我给你也泄露泄露秘密
那完全就是意识流的……