Add iterating function and the test for it

This commit is contained in:
ASPP Student 2025-09-23 18:07:05 +03:00
parent 4736cc7ac9
commit b192a2a76f
2 changed files with 32 additions and 11 deletions

View file

@ -1,4 +1,13 @@
# Your code goes here
import numpy as np
def f(x, r):
return r * x * (1 - x)
def iterate_f(x, r, n_iterations):
trajectory = np.zeros(n_iterations+1)
trajectory[0] = x
for i in range(n_iterations):
trajectory[i+1] = f(x, r)
x = trajectory[i+1]
return trajectory