Hello, I am using Sage for a while, but I am still a newbie.
I am an engineer studying nonlinear dynamical systems. I do the modeling by means of symbolic manipulation (Galerkin approximation) but I need a numerical solver to time integrate the model. On another tread I mentioned a spkg I made for Assimulo so that I can use the Sundials suite of numerical solvers, particularly IDA. Everything is working fine, but slow. The size of the symbolic system can be changed as the order of approximation goes higher. But the symbolic system remains static during integration, just the variables are substituted at every time- step. The bottleneck is the substitution of state-variables into the symbolic system to turn it into floats which is consumed by the solver at every time-step. The solver needs a residual (and a Jacobian) functions having numpy.array as input and output. I made some experiment streaming out the symbolic system into a Fortran file. I used Maxima's f90 function, but it is very limited. I had to to plenty of vim substitutions to shape it into a usable code. By using this approach on the residual and jacobian functions I has able to cut the run-time from 30min to 30sec on a complicated enough model. Every entry on my symbolic matrices are very long products of polynomials over the state-variables and floating-point coefficients... The Fortran files easily fills a bunch of pages... I am not sure how Cython could help here. I think fast_float and fast_callable cannot handle SR matrices and vectors. Right? Hoping to make the case a bit clearer, I made a quick example on this worksheet: http://www.sagenb.org/home/pub/3115/ I think that having an automated symbolic(matrix/vector)-to-Fortran (f2py) translator for such numerical intensive evaluations wouldn't hurt. Therefore I am looking for instructions on how you guys would proceed do write such translator... if not yet available. Any thoughts or alternatives? Regards, Guilherme -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org