Skip to content

Instantly share code, notes, and snippets.

@ilkermanap
Created April 11, 2020 15:15
Show Gist options
  • Save ilkermanap/561f7e1c454c7667b413e615b92e22b8 to your computer and use it in GitHub Desktop.
Save ilkermanap/561f7e1c454c7667b413e615b92e22b8 to your computer and use it in GitHub Desktop.
bessel function
def bessel_series(x, order):
if order == 1:
return 1
sign = 1
if (order % 2) == 0:
sign = -1
top = x ** ((order * 2) -2 )
bottom = 1
for i in range(1,order):
bottom = bottom * (( i * 2) ** 2)
return sign * (top / bottom)
def bessel(x, order=10):
temp = bessel_series(1,1)
for i in range(2, order):
temp += bessel_series(x,i)
return temp
print(bessel(1.2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment