1

I want to ufuncify Sympy's FallingFactorial function so that it works similar to numpy on array inputs instead of just a pair of integers.

I tried the following code:

from sympy.functions.combinatorial.factorials import FallingFactorial
from sympy.utilities.autowrap import ufuncify
from sympy.abc import A,B
FF = ufuncify((A,B), FallingFactorial(A,B))

But I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/sympy/utilities/autowrap.py", line 486, in ufuncify
    return autowrap(C.Equality(y[i], f(*args)), **kwargs)
  File "/usr/lib/python2.7/dist-packages/sympy/utilities/autowrap.py", line 404, in autowrap
    return code_wrapper.wrap_code(routine, helpers=helps)
  File "/usr/lib/python2.7/dist-packages/sympy/utilities/autowrap.py", line 141, in wrap_code
    mod = __import__(self.module_name)
ImportError: ./wrapper_module_0.so: undefined symbol: fallingfactorial_

Does the code above work for anyone else or do I have something wrong? I'm using Python 2.7 and Sympy 0.7.4.1

sambajetson
  • 193
  • 1
  • 9
  • Looks like the autowrap step is a problem there. The same happens with ordinary factorial, and even without ufuncify. Here's a simpler example: `from sympy import*`, `from sympy.utilities.autowrap import autowrap` , `x = Symbol('x')`, `autowrap(sin(x))`, `autowrap(factorial(x))`. In this example, the sine gets wrapped with no problem, but factorial throws the error you encountered. I'd say it's an issue with SymPy –  Dec 29 '16 at 06:20
  • Still getting this same error after updating package from Sympy 0.7.4.1 to most recent version 1.0 – sambajetson Jan 04 '17 at 18:25

0 Answers0