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

While loops with iteation control INVERSELLIPTIC2 #12

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments
Open

While loops with iteation control INVERSELLIPTIC2 #12

GoogleCodeExporter opened this issue Mar 14, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

- Consider using atan2 instead of atan for the inverselliptic2.m because it's 
more stable and you won't need the eps for the denominator.
- My project required plugging in large numbers in the inverselliptic2.m 
function, which won't work because there's only 4 iterations. So I'd recommend 
using a while loop:
        [~, E] = elliptic12(invE(:),m,tol);
        dinvE = (E - z)./sqrt( 1-m.*sin(invE(:)).^2 );
        while max(abs(dinvE)) > tol
            invE(:) = invE(:)-dinvE;
            [~, E] = elliptic12(invE(:),m,tol);
            dinvE = (E - z)./sqrt( 1-m.*sin(invE(:)).^2 );
        end
        invE(:) = invE(:)-dinvE;

    instead of:
        for iter=1:4
            [~, E] = elliptic12(invE(:),m,tol);
            invE(:) = invE(:)-(E - z)./sqrt( 1-m.*sin(invE(:)).^2 );
        end

Original issue reported on code.google.com by [email protected] on 5 Jan 2014 at 9:08

@moiseevigor moiseevigor changed the title While loops with iteation control While loops with iteation control INVERSELLIPTIC2 Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants