The only thing that I can see that would be different here is the size
of the input array. What is Dim_col[0]? Note that for me, anything >=
8 gives nan in the result (due to precision loss). It looks like the
default behavior of the "safe" casting has changed in recent versions
of numpy (
https://docs.scipy.org/doc/numpy/reference/generated/numpy.can_cast.html),
so the version of numpy you are using is important. What versions of
numpy and scipy are you using?
>
>
>
> Here is the error when using `sympy.special` bessel functions :
>
>
> File "Numeric\Get_System_Num.py", line 183, in get_Mat
> smat = lambdify(m, expr, modules=libraries)(vcm)
>
> File "<string>", line 1, in <lambda>
>
> File
> "C:\Users\Emile\Anaconda2\lib\site-packages\sympy\core\function.py", line
> 375, in __new__
> result = super(Function, cls).__new__(cls, *args, **options)
>
> File
> "C:\Users\Emile\Anaconda2\lib\site-packages\sympy\core\function.py", line
> 199, in __new__
> evaluated = cls.eval(*args)
>
> File
> "C:\Users\Emile\Anaconda2\lib\site-packages\sympy\functions\special\bessel.py",
> line 161, in eval
> if nu.is_integer:
>
> AttributeError: 'numpy.ndarray' object has no attribute 'is_integer'
No, this won't work. You can't use NumPy arrays as input to SymPy
functions. SymPy functions only work with SymPy expressions. If you
want to use a NumPy array you have to lambdify the expression first to
use the numpy and scipy functions.
>
>
> When I try to lambdify this simple expression :
> `17469169.5935065*sin(0.942966379693359*m)*cos(1.5707963267949*m)/m`, with
> "numpy" as module argument, it gives : `'float' object has no attribute
> 'sin'`
I can't reproduce this. What is the input to the lambdified function?
>
> I have also tried the packaged module 'numexpr' without success, as it stops
> on this other expression : `0.058**(46.6321243523316*k)`, saying :
>
> File
> "C:\Users\Emile\Anaconda2\lib\site-packages\numexpr\necompiler.py", line
> 756, in evaluate
> signature = [(name, getType(arg)) for (name, arg) in zip(names,
> arguments)]
>
> File
> "C:\Users\Emile\Anaconda2\lib\site-packages\numexpr\necompiler.py", line
> 654, in getType
> raise ValueError("unknown type %s" %
a.dtype.name)
>
> ValueError: unknown type object
I also can't reproduce this.
Aaron Meurer
>
>
>
> It seems that `lambdify` cannot interprete properly the input value in the
> bessel function in the program code (wether it is with scipy or sympy bessel
> functions), as the input value seems to be an array object, while it is not
> a problem in the single code. Yet I do not see the difference between them.
> There is also a problem about defining the modules, even if numpy and bessel
> functions are correctly specified.
> So I really don't know the nature of this problem, and I can't even track it
> as the exception raised comes from inside sympy and I don't know how to put
> flags in sympy functions.
> Thank you for reading this, and I hope someone may help me on this topic.
> Please tell me if more information are needed to illustrate this problem.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
sympy+un...@googlegroups.com.
> To post to this group, send email to
sy...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/sympy.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sympy/470d0442-aaa1-4a79-b4b2-4fabbc011235%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.