Cody

Problem 46012. Find the zeros of the Bessel function of the first kind

Solution 2690531

Submitted on 14 Jul 2020 by ChrisR
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
nu = 0; k = 1; j_correct = 2.404825557695773; assert(abs(BesselJzero(nu,k)-j_correct)/j_correct < 1e-4)

2   Pass
nu = 1; k = 3; j_correct = 10.17346813506272; assert(abs(BesselJzero(nu,k)-j_correct)/j_correct < 1e-4)

3   Pass
nu = 2; k = 2; j_correct = 8.41724414039981; jp_correct = 6.70613; [j,jp] = BesselJzero(nu,k); assert(abs(j-j_correct)/j_correct < 1e-4) assert(abs(jp-jp_correct)/jp_correct < 1e-4)

4   Pass
nu = 0; j_correct = [2.404826 5.520078 8.653728 11.791534 14.930918]; jp_correct = [0 3.831706 7.015587 10.173468 13.323692]; for k = 1:5 [j(k) jp(k)] = BesselJzero(nu,k); end assert(all(abs(j-j_correct)/j_correct < 1e-4)) assert(all(abs(jp-jp_correct)/jp_correct < 1e-4))

5   Pass
nu = 3; j_correct = [6.380162 9.761023 13.015201 16.223466 19.409415]; jp_correct = [4.20119 8.01524 11.3459 14.5858 17.7887]; for k = 1:5 [j(k) jp(k)] = BesselJzero(nu,k); end assert(all(abs(j-j_correct)/j_correct < 1e-4)) assert(all(abs(jp-jp_correct)/jp_correct < 1e-4))

6   Pass
nu = 1/3; k = 5; j_correct = 15.450649; assert(abs(BesselJzero(nu,k)-j_correct)/j_correct < 1e-4)

7   Pass
nu = 1/2; k = randi(5); j_correct = k*pi; assert(abs(BesselJzero(nu,k)-j_correct)/j_correct < 1e-4)