Increasing accuracy of Whittaker functions

4 次查看(过去 30 天)
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 个评论
Joshua Brown
Joshua Brown 2023-9-23
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by