2

I have lambdify-ied a vector function of a modified FitzHugh–Nagumo model (with no diffusion terms):

from sympy import symbols, Matrix, solve, Eq
from sympy import diff, simplify, lambdify
from sympy.utilities.autowrap import ufuncify


u, v , e, a0, a1 = symbols('u v e a0 a1')

dudt = u - u**3 -v
dvdt = e*(u - a1*v - a0)

eqs = Matrix([dudt,dvdt])
print eqs

numerical_eqs = eqs.subs([(e,1.0),(a0,0.5),(a1,1.0)])
print numerical_eqs
lambdify_eqs = lambdify([u,v], numerical_eqs)
print lambdify_eqs(1.0,0.5)

But trying to produce a ufunc in the same way results in an error:

ufuncify_eqs = ufuncify([u,v], numerical_eqs)

The error message that I get ends with:

CodeGenArgumentListError: ('out_817415551552344190', [<sympy.utilities.codegen.OutputArgument object at 0x7f8da54dccd0>])

Someone knows what is the right way to ufuncify a vector function?

Ohm
  • 2,312
  • 4
  • 36
  • 75

1 Answers1

1

I don't think that ufuncify supports SymPy Matrices as the expression yet. You can do each expression in the matrix individually.

moorepants
  • 1,813
  • 2
  • 22
  • 23