Search This Blog

Saturday, July 2, 2011

Bessel function plot


#Bessel function plot
from pylab import*
def fact(n):
    if n<=1:
        return(1)
    else:
        return(n*fact(n-1))
xdat=linspace(0,8*pi,200)

for n in range(5):
    jnx=[]
    for x in xdat:
        sum=0
        for k in range(0,50):
            sum+=(-1)**k*(x/2)**(n+2*k)/(fact(k)*fact(n+k))
        jnx.append(sum)
   
    plot(xdat,jnx)
   
show()

No comments:

Post a Comment