Ask Your Question
1

Numerical Integration Causes Errors

asked 2012-06-27 14:44:12 -0600

kire321 gravatar image

updated 2016-01-06 18:05:38 -0600

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 ...
(more)
edit retag flag offensive close merge delete

Comments

have the same error, have you a workaround?

petres gravatar imagepetres ( 2012-11-30 01:40:17 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-01-06 18:07:55 -0600

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-06-27 14:44:12 -0600

Seen: 365 times

Last updated: Jan 06 '16