## How to solve this equation which contains complex number, bessel equation and its derivative?

Asked by bohan shen

### bohan shen (view profile)

on 10 Jul 2019
Latest activity Commented on by bohan shen

### bohan shen (view profile)

on 11 Jul 2019
Accepted Answer by David Goodmanson

### David Goodmanson (view profile)

1i*besselj(1,x) - x.*(besselj(0,x) - besselj(2,x))/2 = 0;
I can't solve this equation because it contains complex number. This equation is very important for my dissertation. If anyone knows the solution, please help me out... Thanks in advance!

Answer by David Goodmanson

### David Goodmanson (view profile)

on 11 Jul 2019
Edited by David Goodmanson

### David Goodmanson (view profile)

on 11 Jul 2019

Hi bohan shen,
The first six roots are shown below. First, since J1 is odd and J0,J2 are even, if z is a root then so is -z. The contour plot of abs(f(z)) shows roots in quadrant IV, meaning there also roots in quadrant II. No roots in quadrants I or III.
Roots are determined by Newton's method. Each initial estimate has to be within an enclosed contour. From the contour plot the estimate of 3 looks a bit sketchy (2-.6i would have been a sure thing) but it worked anyway.
clear i % precaution
xx = 0:.01:20;
yy = -1:.01:1;
[x y] = meshgrid(xx,yy);
z = x+i*y;
f = @(z) i*besselj(1,z) - (z/2).*(besselj(0,z) - besselj(2,z));
dfdz = @(z) ((i-1)/2)*(besselj(0,z) - besselj(2,z)) ...
+ (z/2).*((3/2)*besselj(1,z) -(1/2)*besselj(3,z));
contour(x,y,abs(f(z)))
grid on
w0 = [3;6;9;12;15;18]; % initial estimates
w = w0;
for k = 1:10
w = w - f(w)./dfdz(w);
end
w % roots
f(w) % should be small
w =
2.0811 - 0.6681i
5.3355 - 0.1967i
8.5372 - 0.1193i
11.7063 - 0.0863i
14.8637 - 0.0677i
18.0156 - 0.0557i

bohan shen

### bohan shen (view profile)

on 11 Jul 2019
Thank you for your solution! It worked and helped me a lot!

### Torsten (view profile)

on 11 Jul 2019
Edited by Torsten

### Torsten (view profile)

on 11 Jul 2019

x0 = [2; 1];
fun = @(x)[real(1i*besselj(1,complex(x(1),x(2)))-complex(x(1),x(2)).*(besselj(0,complex(x(1),x(2)))-besselj(2,complex(x(1),x(2))))/2);imag(1i*besselj(1,complex(x(1),x(2)))-complex(x(1),x(2)).*(besselj(0,complex(x(1),x(2)))-besselj(2,complex(x(1),x(2))))/2)];
sol = fsolve(fun,x0)
fun(sol)
Note that your equation appears to have an infinite number of solutions. Depending on the initial guess vector x0, "fsolve" converges to different roots.
For comparison with David's solution:
X0 = [3 0;6 0; 9 0; 12 0; 15 0; 18 0];
fun = @(x)[real(1i*besselj(1,complex(x(1),x(2)))-complex(x(1),x(2)).*(besselj(0,complex(x(1),x(2)))-besselj(2,complex(x(1),x(2))))/2);imag(1i*besselj(1,complex(x(1),x(2)))-complex(x(1),x(2)).*(besselj(0,complex(x(1),x(2)))-besselj(2,complex(x(1),x(2))))/2)];
for i = 1:size(X0,1)
x0 = X0(i,:);
sol = fsolve(fun,x0);
Sol(i) = complex(sol(1),sol(2));
end
Sol

bohan shen

### bohan shen (view profile)

on 11 Jul 2019
Thank you for your solution!