Logistic map tests

This commit is contained in:
ASPP Student 2025-09-23 16:57:34 +03:00
parent 952f8b97a5
commit d464e60b06
2 changed files with 13 additions and 0 deletions

View file

@ -1 +1,4 @@
# Your code goes here
def f(x, r):
return r * x * (1 - x)

View file

@ -13,6 +13,16 @@ def test_f_corner_cases():
result = f(x, r)
assert_allclose(result, expected)
def test_f_generic_cases():
cases = [
(0.1, 2.2 ,0.198),
(0.2, 3.4 ,0.544),
(0.5, 2 ,0.5)
]
for x, r, expected in cases:
result = f(x, r)
assert_allclose(result, expected)
# Hands on 1
#Add a new test for these generic cases using the for-loop pattern:
# x=0.1, r=2.2 => f(x, r)=0.198