{"action":"created","issue":{"url":"https://api.github.com/repos/scipy/scipy/issues/5623","labels_url":"https://api.github.com/repos/scipy/scipy/issues/5623/labels{/name}","comments_url":"https://api.github.com/repos/scipy/scipy/issues/5623/comments","events_url":"https://api.github.com/repos/scipy/scipy/issues/5623/events","html_url":"https://github.com/scipy/scipy/pull/5623","id":123734199,"number":5623,"title":"ENH: special: Add vectorized spherical Bessel functions.","user":{"login":"tpudlik","id":4148295,"avatar_url":"https://avatars.githubusercontent.com/u/4148295?v=3","gravatar_id":"","url":"https://api.github.com/users/tpudlik","html_url":"https://github.com/tpudlik","followers_url":"https://api.github.com/users/tpudlik/followers","following_url":"https://api.github.com/users/tpudlik/following{/other_user}","gists_url":"https://api.github.com/users/tpudlik/gists{/gist_id}","starred_url":"https://api.github.com/users/tpudlik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpudlik/subscriptions","organizations_url":"https://api.github.com/users/tpudlik/orgs","repos_url":"https://api.github.com/users/tpudlik/repos","events_url":"https://api.github.com/users/tpudlik/events{/privacy}","received_events_url":"https://api.github.com/users/tpudlik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scipy/scipy/labels/enhancement","name":"enhancement","color":"bfe5bf"},{"url":"https://api.github.com/repos/scipy/scipy/labels/scipy.special","name":"scipy.special","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/scipy/scipy/milestones/28","html_url":"https://github.com/scipy/scipy/milestones/0.18.0","labels_url":"https://api.github.com/repos/scipy/scipy/milestones/28/labels","id":1253031,"number":28,"title":"0.18.0","description":"","creator":{"login":"rgommers","id":98330,"avatar_url":"https://avatars.githubusercontent.com/u/98330?v=3","gravatar_id":"","url":"https://api.github.com/users/rgommers","html_url":"https://github.com/rgommers","followers_url":"https://api.github.com/users/rgommers/followers","following_url":"https://api.github.com/users/rgommers/following{/other_user}","gists_url":"https://api.github.com/users/rgommers/gists{/gist_id}","starred_url":"https://api.github.com/users/rgommers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgommers/subscriptions","organizations_url":"https://api.github.com/users/rgommers/orgs","repos_url":"https://api.github.com/users/rgommers/repos","events_url":"https://api.github.com/users/rgommers/events{/privacy}","received_events_url":"https://api.github.com/users/rgommers/received_events","type":"User","site_admin":false},"open_issues":10,"closed_issues":14,"state":"open","created_at":"2015-08-13T05:52:53Z","updated_at":"2016-01-04T13:45:39Z","due_on":"2016-06-14T22:00:00Z","closed_at":null},"comments":6,"created_at":"2015-12-23T23:00:49Z","updated_at":"2016-01-04T16:25:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scipy/scipy/pulls/5623","html_url":"https://github.com/scipy/scipy/pull/5623","diff_url":"https://github.com/scipy/scipy/pull/5623.diff","patch_url":"https://github.com/scipy/scipy/pull/5623.patch"},"body":"This PR provides four new ufuncs,\r\n    \r\n*   `spherical_jn`\r\n*   `spherical_yn`\r\n*   `spherical_in`\r\n*   `spherical_kn`\r\n\r\nThey are vectorized alternatives to the `specfun` wrappers `sph_jn`, `sph_yn`, `sph_in`, and  `sph_kn`, providing a nicer interface, slightly higher performance and (thanks to the use of different algorithms) better stability for large real inputs.  Derivatives of spherical Bessel functions, which are also computed by the `specfun` wrappers, are not yet implemented.\r\n\r\nThe performance improvement is not dramatic, at a little over an order of magnitude:\r\n\r\n```python\r\n@np.vectorize\r\ndef old_way_kn(n, z):\r\n    return sph_kn(n, z)[0][-1]\r\n\r\nx = 10**np.linspace(-2, 3, 5000)\r\nn = 15\r\n\r\n>>> %timeit old_way_kn(n, x)\r\n10 loops, best of 3: 72.4 ms per loop\r\n\r\n>>> %timeit spherical_kn(n, x)\r\n100 loops, best of 3: 2.57 ms per loop\r\n```\r\n\r\nBetter stability, especially in `spherical_jn` and `spherical_in` for large (> 10**3) real argument values, is obtained by replacing the recursive `specfun` algorithms with calls to AMOS/CEPHES cylindrical Bessel function routines, using [these identities](http://dlmf.nist.gov/10.47).\r\n\r\nFixes #1641 and #2165, and (except for the still missing derivatives) implements #3113."},"comment":{"url":"https://api.github.com/repos/scipy/scipy/issues/comments/168723645","html_url":"https://github.com/scipy/scipy/pull/5623#issuecomment-168723645","issue_url":"https://api.github.com/repos/scipy/scipy/issues/5623","id":168723645,"user":{"login":"ev-br","id":2133832,"avatar_url":"https://avatars.githubusercontent.com/u/2133832?v=3","gravatar_id":"","url":"https://api.github.com/users/ev-br","html_url":"https://github.com/ev-br","followers_url":"https://api.github.com/users/ev-br/followers","following_url":"https://api.github.com/users/ev-br/following{/other_user}","gists_url":"https://api.github.com/users/ev-br/gists{/gist_id}","starred_url":"https://api.github.com/users/ev-br/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ev-br/subscriptions","organizations_url":"https://api.github.com/users/ev-br/orgs","repos_url":"https://api.github.com/users/ev-br/repos","events_url":"https://api.github.com/users/ev-br/events{/privacy}","received_events_url":"https://api.github.com/users/ev-br/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T16:25:56Z","updated_at":"2016-01-04T16:25:56Z","body":"https://github.com/ev-br/scipy/commit/e305b53291ffde443d313810b9745382122ca74c tries to add a quick-and-dirty testing of `spherical_jn` and `spherical_kn` against boost. Both fail :-(. OTOH, `sph_jn` fails as well."}}