diff --git a/logistic.py b/logistic.py index e49d1c2..d759f04 100644 --- a/logistic.py +++ b/logistic.py @@ -1 +1,7 @@ # Your code goes here + +def f(x, r): + + return r*x*(1-x) + + diff --git a/test_logistic.py b/test_logistic.py index 9391bee..f5d014d 100644 --- a/test_logistic.py +++ b/test_logistic.py @@ -14,3 +14,15 @@ def test_f_corner_cases(): for x, r, expected in cases: result = f(x, r) assert_allclose(result, expected) + +def test_f_generic_cases(): + # Test cases are (x, r, expected) + 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) +