Created
April 11, 2020 15:15
-
-
Save ilkermanap/561f7e1c454c7667b413e615b92e22b8 to your computer and use it in GitHub Desktop.
bessel function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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