2020-04-03 21:12:51 +0200 | received badge | ● Student (source) |
2020-03-31 15:19:29 +0200 | asked a question | Hypergeometric function does not accept a numpy array element Hello. I am dealing with a very elementary problem. I need to compute an array of complex legendre function value, using a definition by hypergeometric function. My code is following: But when I run it an error message appears reading: NotImplementedError: The Function hypergeometric does not support numpy arrays as arguments |
2020-03-31 15:19:29 +0200 | asked a question | The bessel_K function does not accept an element of a numpy array I had a problem with classical sage ploting of Bessel K function in classical way, so I tried to manage through python matplotlib.pyplot and numpy library. My code looks like this (for some reasons the formating put lines together, co I had to add a free line every time - just here, there are not present in original code): But it gives me the following error message: NotImplementedError: The Function bessel_K does not support numpy arrays as arguments If I delete " *ro2[i] ", everything works just fine. If I print for example r2[100] I get a real number, not an array. Any ideas what could it be? |
2020-03-31 15:19:29 +0200 | asked a question | bessel_K does not accept an element of a numpy array I had a problem with classical sage ploting of Bessel K function in classical way, so I tried to manage through python matplotlib.pyplot and numpy library. My code looks like this (for some reasons the formating put lines together, co I had to add a free line every time - just here, there are not present in original code): import numpy as np import matplotlib.pyplot as plt def P(l,m,x): return (-1)^mgamma(l+m+1)(1-x^2)^(m/2)/2^m/gamma(l-m+1)/gamma(m+1)*hypergeometric([m-l,m+l+1],[1+m],(1-x)/2) N=1000 l1=-0.01996 romin=0 romax=1 a=sqrt(3).n() R=1 m=0 roDD=R*a/sqrt(1+a^2).n() nu=a*i/2 xDD=asqrt(abs(l1(l1+1))) ccD=1/sqrt(1+a^2) A=P(l1,m,ccD)/bessel_K(nu,xDD) f2=np.zeros(N) ro2=np.linspace(roDD,romax,N) for i in range(N): But it gives me the following error message: NotImplementedError: The Function bessel_K does not support numpy arrays as arguments If I delete " *ro2[i] ", everything works just fine. If I print for example r2[100] I get a real number, not an array. Any ideas what could it be? |