Solve this problem by using python I need code Write a funct
Solve this problem by using python. I need code.
Write a function that can return each of the lint three spherical Bessel functions j_n(x): j_0 (x) = sin x/x j_1 (x) = sin x/x^2 - cos x/x j_1 (x) = (3/z^2 - 1) sin x/x - 3 cos x/x^2 Your function should take as argument a NumPy array x and the order n, and should return an array of the designated order n spherical Bessel function. Take care to make sure that your functions behave properly at x = 0. Demonstrate the use of your function by writing a Python routine that plots the three Bend functions for 0 lessthanorequalto x lessthanorequalto 20. Your plot should look like the one below. Something to think about: You might note that f_1(x) can be written in terms of j_0(x), can be written in terms of j_1(x) and j_0(x). Can you take advantage of this to write a more efficient function for the calculations of j_1(x) and j_2(x)?Solution
import scipy.special
 print scipy.special.j0
 j0(x[, out])
y=j0(x) scipy.special.j0(1)
def sinc(x):
 y = []
 for xx in x:
 if xx==0.0:   
 y += [1.0]
 else:   
 y += [np.sin(xx)/xx]
 print \" spherical Bessel Function\"
 print np.[sinx/x]
 print [sph_in(x)[0][-1] for x in X]   
print \"spherical Bessel Function\"
 print np.[(sinx/(x*x))-(cosx/x)]
 print [sph_jn(x)[0][-1] for x in X]
print \"spherical Bessel Function\"
 print np.[(((3/(x*x))-1)*(sinx/x))-(3*cosx/(x*x))]
 print [sph_jn(x)[0][-1] for x in X]
return np.array(y)
import numpy as np
 import matplotlib.pyplot as plt
j0 = lambda x: besselj(0,x)
 j1 = lambda x: besselj(1,x)
 j2 = lambda x: besselj(2,x)
 plot([j0,j1,j2,j3],[0,14])

