elliptic
elliptic copied to clipboard
A precision problem on elliptic123
Dear virogr, there might be a problem with the precision of elliptic123. I run the following code on 64bit linux version of Matlab: K>> [~, K1]= elliptic123(pi/2, 1+2.*eps(0.5))
K1 =
NaN + NaNi
K>> [~, K1]= elliptic123(pi/2, 1)
K1 =
1
K>> ellipticE(pi/2, 1+2.*eps(0.5))
ans =
1
K>> ellipticE(pi/2, 1)
ans =
1
Thanks! Best wishes, Jinchuan
This was my code originally (I think)... I’ll see what I can do. Thanks!
Dear Will, Thanks for the response. I wish the problem will be fixed soon.
Best wishes, Jinchuan
An update: I could locate e=0 in elliptic12ic when calling [~, K1]= elliptic123(pi/2, 1+2.*eps(0.5)). This may cause the NaN problem.
Currently, I have added a nasty line to avoid the NaN problem in function elliptic123, which is just a temporary solution.
if nargout<3
if nargin==1
[F,E] = elliptic12c(a1); % == elliptic12(m)
elseif nargin==2
a2(abs(a2-1)<4.6*eps(1))=1; % Added by Jinchuan
[F,E] = elliptic12x(a1,a2); % == elliptic12(b,m)
I hope this could help a little bit.
Best wishes, Jinchuan