资源简介
can draw the model of the DLA cluster
代码片段和文件信息
# -*- coding: utf-8 -*-
import numpy as np
from pylab import *
import random as ra
import matplotlib.pyplot as plt
from random import choice
fig = plt.figure()
ax=fig.add_subplot(111)
x=np.zeros((8080))
x[40][40]=1
ax.plot(4040‘b.‘)
for n in range (010):
X=[]
Y=[]
d=0
for i in range (179):
for j in range (179):
if x[ij]==0 and (x[i+1j]==1 or x[i-1j]==1 or x[ij+1]==1 or x[ij-1]==1):
d=d+1
X.append(i)
Y.append(j)
a=ra.randint(0d-1)
b=X[a]
c=Y[a]
x[b][c]=1
for n1 in range (010):
X1=[]
Y1=[]
d1=0
m=0
for i1 in range (179):
for j1 in range (179):
if x[i1j1]==0 and (x[i1+1j1]==1 or x[i1-1j1]==1 or x[i1j1+1]==1 or x[i1j1-1]==1):
评论
共有 条评论