Increasing accuracy of Whittaker functions

5 views (last 30 days)
Yuriy Yerin
Yuriy Yerin on 18 Jul 2020
Commented: Joshua Brown on 23 Sep 2023
Hello.
I know that there were a lot questions devoted to accuracy of fslove procedure.
I'm trying to solve a transcendental equation with so-called Whittaker functions and the gamma function
where k is the integer number, and are some parameters (see below) and E is the unknown variable.
Below is my code
function z=dispersion
mm=linspace(0,20,21);
for j=1:21
[y,fval]=fzero(@(E) self(E,mm(j)),0.51,optimset('Display','off','TolFun', 1.0e-15, 'TolX',1.0e-15));
Energy(j)=y;
value(j)=fval;
end
Energy
value
end
function z=self(E,m)
r1=0.25;
r2=5;
z=gamma(1/2+floor(abs(m))/2-E-floor(m)/2).*(whittakerM(E+floor(m)/2,floor(abs(m))/2,r2^2/2).*whittakerW(E+floor(m)/2,floor(abs(m))/2,r1^2/2)-...
whittakerM(E+floor(m)/2,floor(abs(m))/2,r1^2/2).*whittakerW(E+floor(m)/2,floor(abs(m))/2,r2^2/2));
end
I have a problem with accuracy of Whittaker functions in the case of large parameter m . When for instance I obtain and value = -3.048609148470981*1.0e+22 that is inappropriate accuracy. Is it possible to resolve such a kind of problem?
P.S. Actually I understand the origin of the problem. Abnormal values of fval is due to behaviour of Whittaker functions for large values of m. Nevertheless I would greatly appreciate for any suggestions.
  1 Comment
Joshua Brown
Joshua Brown on 23 Sep 2023
Hey! I've had the same issue. A quick fix is the folowing:
m = sym(m);
double(whittakerM(E+floor(m)/2,floor(abs(m))/2,r1^2/2));
(I.e. going via symbolic algebra to deal with things like (e^(pi*m))*e^-(pi*m) better) then should be accurate even for large m.

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!