[SciPy-dev] Test case for integrate/ode.py: banded systems
Jesper Friis
jesper.friis at material.ntnu.no
Mon Mar 6 03:17:20 CST 2006
I hope this is the correct place to post messages like this. Last Friday
I submitted a small patch for integrate/ode.py making it working for
banded systems. I have now successfully applied the solver to the banded
example problem included in the cvode package. The attached script might
both work as a test and as an example on how to solve banded systems.
I think, especially the following comment considering the Jacobian might
be of general interest:
# The Jacobian.
# For banded systems this function returns a matrix pd of
# size ml+mu*2+1 by neq containing the partial derivatives
# df[k]/du[u]. Here f is the right hand side function in
# udot=f(t,u), ml and mu are the lower and upper half bandwidths
# and neq the number of equations. The derivatives df[k]/du[l]
# are loaded into pd[mu+k-l,k], i.e. the diagonals are loaded into
# the rows of pd from top down (fortran indexing).
#
# Confusingly, the number of rows VODE expect is not ml+mu+1, but
# given by a parameter nrowpd, which unfortunately is left out in
# the python interface. However, it seems that VODE expect that
# nrowpd = ml+2*mu+1. E.g. for our system with ml=mu=5 VODE expect
# 16 rows. Fortunately the f2py interface prints out an error if
# the number of rows is wrong, so as long ml and mu are known in
# beforehand one can always determine nrowpd by trial and error...
Regards
/Jesper
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_ode_banded.py
Type: text/x-python
Size: 5695 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20060306/250169a4/attachment.py
More information about the Scipy-dev
mailing list