# Numerical Integration Causes Errors

I have a 4 ODE model of a chemical oscillator. desolve_system_rk4 and desolve_odeint give different, equally strange errors. My source and the errors are pasted below. Any ideas what could be causing this?

------Cell 1-------

var('x y z u t')
m = .4; a = .3; h = .16
k1 = (2e6)*h
k2 = 2*(h^2)*a
k3 = 3000
k4 = 42*h*a
k7 = 29*m
k9 = .1*m if m>=.1 else .07*m
k10 = 0.05*m
kr = 2e8
kred = 5e6
d = 1e-5
c0 = 3e-3
cmin = sqrt((2*kr*(k9+k10)*c0)/(kred^2))
rhs = []
rhs.append(-k1*x*y+k2*y-2*k3*(x^2)+k4*x*((c0-z)/(c0-z+cmin)))
rhs.append(-3*k1*x*y-2*k2*y*-k3*(x^2)+k7*u+k9*z)
rhs.append(2*k4*x*((c0-z)/(c0-z+cmin))-k9*z-k10*z)
rhs.append(2*k1*x*y+k2*y+k3*(x^2)-k7*u)


-------Cell 2-------

desolve_odeint(rhs,[0,.1,.5,0,0],srange(0,.28,.01),[x,y,z,u],t)


---------Cell 2 Error-----

Traceback (most recent call last):

File "/home/sage/sage-4.8/local/lib/python2.6/site-packages/sage/calculus

/desolvers.py", line 1529, in func

return [dec(*v) for dec in desc]

File "wrapper_rdf.pyx", line 73, in

sage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (sage/ext/interpreters
/wrapper_rdf.c:1289)

ValueError

odepack.error: Error occured while calling the Python function named func

Traceback (most recent call last):

File "/home/sage/sage-4.8/local/lib/python2.6/site-packages/sage/calculus

/desolvers.py", line 1529, in func

return [dec(*v) for dec in desc]

File "wrapper_rdf.pyx", line 73, in

sage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (sage/ext/interpreters

/wrapper_rdf.c:1289)

ValueError

odepack.error: Error occured while calling the Python function named func

Traceback (most recent call last):

File "/home/sage/sage-4.8/local/lib/python2.6/site-packages/sage/calculus

/desolvers.py", line 1529, in func

return [dec(*v) for dec in desc]

File "wrapper_rdf.pyx", line 73, in

sage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (sage/ext/interpreters

/wrapper_rdf.c:1289)

ValueError

odepack.error: Error occured while calling the Python function named func

Traceback (most recent call last):

File "/home/sage/sage-4.8/local/lib/python2.6/site-packages/sage/calculus

/desolvers.py", line 1529, in func

return [dec(*v) for dec in desc]

File "wrapper_rdf.pyx", line 73, in

sage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (sage/ext/interpreters

/wrapper_rdf.c:1289)

ValueError

odepack.error: Error occured while calling the Python function named func

Traceback (most recent call last):

File "/home/sage/sage-4.8/local/lib/python2.6/site-packages/sage/calculus

/desolvers.py", line 1529, in func

return [dec(*v) for dec in desc]

File "wrapper_rdf.pyx", line 73, in

sage.ext.interpreters.wrapper_rdf.Wrapper_rdf.__call__ (sage/ext/interpreters

/wrapper_rdf.c:1289)

ValueError

odepack.error: Error occured while calling the Python function named func

Traceback (most recent call last):

File "/home/sage/sage-4.8/local/lib/python2.6/site-packages/sage/calculus

/desolvers.py", line 1529, in func

return [dec(*v) for dec in desc ...
edit retag close merge delete

have the same error, have you a workaround?

( 2012-11-30 08:40:17 +0200 )edit

Sort by ยป oldest newest most voted

In your cell 2, rhs has length 4 but you feed the initial values with a list of 5 terms long...

more

## Stats

Seen: 720 times

Last updated: Jan 07 '16