Increasing accuracy of Whittaker functions
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Joshua Brown
el 23 de Sept. de 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.
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!