Increasing accuracy of Whittaker functions
3 ビュー (過去 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/333672/image.png)
where k is the integer number,
and
are some parameters (see below) and E is the unknown variable.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/333675/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/333678/image.png)
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?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/333681/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/333684/image.png)
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
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 Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!