How do I translate ODE23 from Matlab to Python
<p>I am currently trying to translate my code from MATLAB to Python. The issue that I have is with translating an ODE to Python. I have read on the internet that I could use scipy.integrate.ode/scipy.integrate.odeint for this. Unfortunately, I cannot get it the way I would like to have it.</p>

<p>My MATLAB code is as follows: </p>

<pre><code>function [W] = PSFFA_MM1 (arrivalRate, serviceRate)

tspan = 1:1:96;
ic = 0;
opts = odeset('RelTol',1e-2,'AbsTol',1e-4);

[t,x] = ode23(@(t,x) myode(t,x,arrivalRate, serviceRate), tspan,ic,opts);

    function dxdt = myode(t,x,lambda, MU)
    l = interp1(lambda, t);
    mu = interp1(MU, t);
    dxdt = -mu*(x/(x+1)) +l;
    end

W = x./arrivalRate;

end
</code></pre>

<p>My Python code is as follows:</p>

<pre><code>def interpolation(rates, point):
    a = math.floor(point)
    b = math.ceil(point)
    c = point

    return rates(a) + (c-a) / (b-a) * (rates(b) - rates(a))

def myode(t,x,lamda, MU):
    l = interpolation(lamda, t)
    mu = interpolation(MU,t)
    dxdt = -mu * (x / (x+1)) + l
    return dxdt

def PSFFA_MM1(arrivalRate, serviceRate):
    timeSpan = np.linspace(1,1,96)
    c = 0

    x = scipy.integrate.odeint(myode(t,x,arrivalRate,serviceRate))
    x = odeint(myode, ic, timeSpan)

    W = x/arrivalRate

    return W here
</code></pre>

<p>One of the points I am struggling with is that in MATLAB there is no need to specify 'x' explicitly, while this has to be specified specifically in Python.</p>

<p>I know that there is not really a specific question, but I hope someone could help me further.</p>