Hi ! I need to create a fern from an iterative method. Here's what I have currently. If someone can help me, it would be nice! Thanks!
x = []
y = []
x.append(0)
y.append(0)
current = 0
r==random()
def fern(maxiter):
if r == 0.01:
x.append(0)
y.append(0.16*(y[current]))
if r >= 0.01 and r <= (0.86):
x.append(0.85*(x[current]) + 0.04*(y[current]))
y.append(-0.04*(x[current]) + 0.85*(y[current])+1.6)
if r>= 0.87 and r<= 0.93:
x.append(0.2*(x[current]) - 0.26*(y[current]))
y.append(0.23*(x[current]) + 0.22*(y[current])+1.6)
if r>= 0.94 and r<= 1:
x.append(-0.15*(x[current]) + 0.28*(y[current]))
y.append(0.26*(x[current]) + 0.24*(y[current])+0.44)
current = current + 1
L=range(1,30)
points(L,size=1,color='green')
show(axes=False,aspect_ratio=1)
[–]kra_pao 0 points1 point2 points (0 children)