0

I have a chemical kinetics problem which involves several species that can transfer electrons between each other. I can describe the kinetics using a system of five differential equations.

I am trying to fit the model to time-resolved spectroscopic data. I believe that this system should be solved analytically, so I am trying to solve the system using sympy's dsolve:

from sympy import *
  

# Assumptions: Since the concentration of Ascn remains practically constant, [Ascn] is absorbed into k1

Ru2p, Rup, Asc, Rep, Re = symbols('Ru2p Rup Asc Rep Re', cls=Function)

Rep0, t, k1, k2, k3, k4 = symbols('Rep0 t k1 k2 k3 k4')

eq1 = Eq(diff(Ru2p(t)), -k1*Ru2p(t))
eq2 = Eq(diff(Rup(t)), k1*Ru2p(t) - k2*Rup(t)*Asc(t) - k3*Rup(t)*Rep(t))
eq3 = Eq(diff(Asc(t)), k1*Ru2p(t) - k2*Rup(t)*Asc(t)-k4*Asc(t)*Re(t))
eq4 = Eq(diff(Rep(t)), -k3*Rup(t)*Rep(t) + k4*Asc(t)*Re(t))
eq5 = Eq(diff(Re(t)), k3*Rup(t)*Rep(t) - k4*Asc(t)*Re(t))

system = [eq1, eq2, eq3, eq4, eq5]
ics = {Ru2p(0):1,Rup(0):0,Asc(0):0,Rep(0):Rep0,Re(0):0}

solution = dsolve(system,[Ru2p(t),Rup(t),Asc(t),Rep(t),Re(t)],ics=ics)
print(solution)

Running this results in:

Traceback (most recent call last):
  File "Ruthenium.py", line 19, in <module>
    solution = dsolve(system,[Ru2p(t),Rup(t),Asc(t),Rep(t),Re(t)],ics=ics)
  File "/home/max/.local/lib/python3.6/site-packages/sympy/solvers/ode/ode.py", line 599, in dsolve
    raise NotImplementedError
NotImplementedError

It is not clear to me what exactly is not implemented, so I don't know what is the current limitation with this method for which I need to find a solution. I would appreciate it if someone can give me some tips about how I might be able to solve this system, preferably with python.

Max
  • 137
  • 6
  • 1
    Do you get a full stacktrace for the error? If so can you add it to your question? – Tom Dalton Mar 25 '21 at 15:43
  • 1
    You might have better luck if you copy and paste your question here: https://mattermodeling.stackexchange.com/ – Nike Apr 02 '21 at 20:33

0 Answers0