Skip to content
DeepForgeby svx
All problems
EasyCalculusca-147

Logistic Map Derivative

Problem

The logistic map is f(x) = r * x * (1 - x). Its derivative is f'(x) = r * (1 - 2x), which controls whether nearby orbits converge or diverge.

Given the parameter r and the state x, return f'(x).

Hint

Differentiate r * x * (1 - x) with respect to x.

Test cases

case 1
in: [4,0.5]
expected: 0
case 2
in: [3,0.25]
expected: 1.5
case 3
in: [2,0]
expected: 2
case 4
in: [1,0.5]
expected: 0
case 5
in: [4,0]
expected: 4
Starter codePython
def logistic_map_derivative(r, x):
    # Your code here
    pass

5 test cases · run your code against them in the editor