Skip to content

搞英语 → 看世界

翻译英文优质信息和名人推特

Menu
  • 首页
  • 作者列表
  • 独立博客
  • 专业媒体
  • 名人推特
  • 邮件列表
  • 关于本站
Menu

随机生成的龙

Posted on 2025-08-17

这里有一个生成名为“双龙”的分形的简单方法。从x和y的随机值开始,并根据规则反复更新

x新= (− x旧+ y旧)/2 − b
y新= (− x旧− y旧)/2

其中, b以相等的概率随机取值为 0 或 1。这些点的图形填充了双龙图。

这是经过 10,000 次迭代之后的图。

twindragon10k.png

经过100,000次迭代。

twindragon100k.png

这是我用来绘制图表的 Python 脚本。

 导入 matplotlib.pyplot 作为 plt 从 numpy.random 导入随机、选择  x,y = 随机(),随机() 对于范围内的_(100000):     x,y = (-x + y)/2,(-x - y)/2     x -= 选择([0,1])     plt.plot(x, y, 'bo', markersize=1) plt.显示() 

这里使用的算法是 [1] 中发现的用于生成类似分形的更通用算法的一个特别例子。

这是几年前的一篇类似帖子:
混沌游戏和谢尔宾斯基三角

[1] Darst,Palagallo和Price。平面中的分形平铺。数学杂志[71]:1,1998年。

随机生成的龙一文最先出现在John D. Cook上。

原文: https://www.johndcook.com/blog/2025/08/16/randomly-generated-dragon/

本站文章系自动翻译,站长会周期检查,如果有不当内容,请点此留言,非常感谢。
  • Abhinav
  • Abigail Pain
  • Adam Fortuna
  • Alberto Gallego
  • Alex Wlchan
  • Answer.AI
  • Arne Bahlo
  • Ben Carlson
  • Ben Kuhn
  • Bert Hubert
  • Big Technology
  • Bits about Money
  • Brian Krebs
  • ByteByteGo
  • Chip Huyen
  • Chips and Cheese
  • Christopher Butler
  • Colin Percival
  • Cool Infographics
  • Dan Sinker
  • David Walsh
  • Dmitry Dolzhenko
  • Dustin Curtis
  • eighty twenty
  • Elad Gil
  • Ellie Huxtable
  • Ethan Dalool
  • Ethan Marcotte
  • Exponential View
  • FAIL Blog
  • Founder Weekly
  • Geoffrey Huntley
  • Geoffrey Litt
  • Greg Mankiw
  • HeardThat Blog
  • Henrique Dias
  • Herman Martinus
  • Hypercritical
  • IEEE Spectrum
  • Investment Talk
  • Jaz
  • Jeff Geerling
  • Jonas Hietala
  • Josh Comeau
  • Lenny Rachitsky
  • Li Haoyi
  • Liz Danzico
  • Lou Plummer
  • Luke Wroblewski
  • Maggie Appleton
  • Matt Baer
  • Matt Stoller
  • Matthias Endler
  • Mert Bulan
  • Mind Matters
  • Mostly metrics
  • Naval Ravikant
  • News Letter
  • NextDraft
  • Non_Interactive
  • Not Boring
  • One Useful Thing
  • Phil Eaton
  • Product Market Fit
  • Readwise
  • ReedyBear
  • Robert Heaton
  • Rohit Patel
  • Ruben Schade
  • Sage Economics
  • Sam Altman
  • Sam Rose
  • selfh.st
  • Shtetl-Optimized
  • Simon schreibt
  • Slashdot
  • Small Good Things
  • Steph Ango
  • Stephen Wolfram
  • Steve Blank
  • Taylor Troesh
  • Telegram Blog
  • The Macro Compass
  • The Pomp Letter
  • thesephist
  • Thinking Deep & Wide
  • Tim Kellogg
  • Understanding AI
  • Wes Kao
  • 英文媒体
  • 英文推特
  • 英文独立博客
©2025 搞英语 → 看世界 | Design: Newspaperly WordPress Theme