{"action":"closed","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/5922","repository_url":"https://api.github.com/repos/scipy/scipy","labels_url":"https://api.github.com/repos/scipy/scipy/issues/5922/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/5922/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/5922/events","html_url":"https://github.com/scipy/scipy/issues/5922","id":138295012,"number":5922,"title":"Suboptimal convergence of Halley's method?","user":{"login":"Juanlu001","id":316517,"avatar_url":"https://avatars2.githubusercontent.com/u/316517?v=4","gravatar_id":"","url":"https://api.github.com/users/Juanlu001","html_url":"https://github.com/Juanlu001","followers_url":"https://api.github.com/users/Juanlu001/followers","following_url":"https://api.github.com/users/Juanlu001/following{/other_user}","gists_url":"https://api.github.com/users/Juanlu001/gists{/gist_id}","starred_url":"https://api.github.com/users/Juanlu001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Juanlu001/subscriptions","organizations_url":"https://api.github.com/users/Juanlu001/orgs","repos_url":"https://api.github.com/users/Juanlu001/repos","events_url":"https://api.github.com/users/Juanlu001/events{/privacy}","received_events_url":"https://api.github.com/users/Juanlu001/received_events","type":"User","site_admin":false},"labels":[{"id":37341011,"url":"https://api.github.com/repos/scipy/scipy/labels/scipy.optimize","name":"scipy.optimize","color":"207de5","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-03-03T20:57:16Z","updated_at":"2018-03-10T02:29:50Z","closed_at":"2018-03-10T02:29:50Z","author_association":"CONTRIBUTOR","body":"While trying out the Halley's method added in #20, I think I have found that the current implementation does not reach cubic convergence.\n\n(_Note: This is a WIP issue, since I admit that this example is [by no means short or self-contained](http://sscce.org/), but I am willing to provide a better example and narrow down the issue as soon as I meet a couple of deadlines_)\n\nThis is the code I'm testing:\n\nhttps://github.com/Juanlu001/poliastro/blob/6483c27/src/poliastro/iod/izzo.py#L174-L210\n\nAnd this is the program I'm using:\n\n``` python\nfrom poliastro.iod import izzo\n\ndef main(M, x_ref, ll_ref):\n    T_ref = izzo._tof_equation(x_ref, 0.0, ll_ref, M)\n    print(M, T_ref)\n    for ii in range(1, 8):\n        try:\n            x, _ = next(izzo._find_xy(ll_ref, T_ref, M, numiter=ii, rtol=1e-30))\n        except RuntimeError as e:\n            x = float(e.args[0].split()[-1])\n            print(ii, x_ref, x, (x - x_ref) / x_ref)\n\nif __name__ == '__main__':\n    main(1, -0.24, 0.5)\n```\n\nWhen using the available SciPy implementation, these are the results. Notice that the last column is the relative error with respect to the known solution:\n\n```\n$ python convergence.py\n1 5.58044804471\n1 -0.24 -0.4031436981968586 0.6797654091535775\n2 -0.24 -0.1769754549412486 -0.2626022710781308\n3 -0.24 -0.2404985599237051 0.0020773330154380083\n4 -0.24 -0.2399999996742607 -1.3572470693630953e-09\n5 -0.24 -0.2400000000000002 9.251858538542972e-16\n```\n\nAnd with [the formula from Wikipedia](https://en.wikipedia.org/wiki/Halley's_method#Method), these are the results:\n\n```\n$ python convergence.py\n1 5.58044804471\n1 -0.24 -0.265113577401703 0.10463990584042918\n2 -0.24 -0.240021887866687 9.1199444529159e-05\n3 -0.24 -0.240000000000016 6.672902970924119e-14\n4 -0.24 -0.2400000000000002 9.251858538542972e-16\n```\n\nI guess the last iteration is subject to truncation error.\n"}}
{"actor":{"display_login":"person142"}}