Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A precision problem on elliptic123 #20

Open
tangjinchuan opened this issue Jul 26, 2018 · 3 comments
Open

A precision problem on elliptic123 #20

tangjinchuan opened this issue Jul 26, 2018 · 3 comments

Comments

@tangjinchuan
Copy link

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

@wspr
Copy link
Collaborator

wspr commented Jul 26, 2018 via email

@tangjinchuan
Copy link
Author

Dear Will,
Thanks for the response. I wish the problem will be fixed soon.

Best wishes,
Jinchuan

@tangjinchuan
Copy link
Author

tangjinchuan commented Jul 30, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants