def dup_spherical_bessel_fn(n, K):
 seq = [[K.one], [K.one, K.zero]]
 for i in range(2, (n + 1)):
  a = dup_mul_ground(dup_lshift(seq[(-1)], 1, K), K(((2 * i) - 1)), K)
  seq.append(dup_sub(a, seq[(-2)], K))
 return dup_lshift(seq[n], 1, K)

def dup_spherical_bessel_fn ( n , K ) : seq = [ [ K . one ] , [ K . one , K . zero ] ] for i in range ( 2 , ( n + 1 ) ) : a = dup_mul_ground ( dup_lshift ( seq [ ( - 1 ) ] , 1 , K ) , K ( ( ( 2 * i ) - 1 ) ) , K ) seq . append ( dup_sub ( a , seq [ ( - 2 ) ] , K ) ) return dup_lshift ( seq [ n ] , 1 , K )
low-level implementation of fn .