{"action":"created","issue":{"url":"https://api.github.com/repos/sympy/sympy/issues/15571","repository_url":"https://api.github.com/repos/sympy/sympy","labels_url":"https://api.github.com/repos/sympy/sympy/issues/15571/labels{/name}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/15571/comments","events_url":"https://api.github.com/repos/sympy/sympy/issues/15571/events","html_url":"https://github.com/sympy/sympy/pull/15571","id":386004640,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM0ODQ3MjQy","number":15571,"title":"[WIP] Remove incorrect method Order._eval_derivative","user":{"login":"normalhuman","id":13082030,"node_id":"MDQ6VXNlcjEzMDgyMDMw","avatar_url":"https://avatars1.githubusercontent.com/u/13082030?v=4","gravatar_id":"","url":"https://api.github.com/users/normalhuman","html_url":"https://github.com/normalhuman","followers_url":"https://api.github.com/users/normalhuman/followers","following_url":"https://api.github.com/users/normalhuman/following{/other_user}","gists_url":"https://api.github.com/users/normalhuman/gists{/gist_id}","starred_url":"https://api.github.com/users/normalhuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normalhuman/subscriptions","organizations_url":"https://api.github.com/users/normalhuman/orgs","repos_url":"https://api.github.com/users/normalhuman/repos","events_url":"https://api.github.com/users/normalhuman/events{/privacy}","received_events_url":"https://api.github.com/users/normalhuman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-30T01:59:26Z","updated_at":"2018-11-30T03:36:19Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/15571","html_url":"https://github.com/sympy/sympy/pull/15571","diff_url":"https://github.com/sympy/sympy/pull/15571.diff","patch_url":"https://github.com/sympy/sympy/pull/15571.patch"},"body":"#### References to other Issues or PRs\r\n\r\nFixes #15570 \r\n\r\n#### Brief description of what is fixed or changed\r\n\r\nThe method `Order._eval_derivative` and some of tests asserted that `O(x**2).diff(x)` is `O(x)`. This is incorrect, as is shown by examples like \r\n\r\n- `x**2 * sin(1/x**2)` (the expression is `O(x**2)` at 0, but its derivative is not even bounded there) \r\n- `x**2 * sin(exp(x))` (the expression is `O(x**2)` at infinity but its derivative grows exponentially)\r\n\r\nThe derivative of Order should remain un-evaluated, as there is no way to determine its size.\r\n\r\n#### Release Notes\r\n\r\n<!-- BEGIN RELEASE NOTES -->\r\n* series\r\n  * the derivative of Order objects returns un-evaluated.\r\n<!-- END RELEASE NOTES -->\r\n"},"comment":{"url":"https://api.github.com/repos/sympy/sympy/issues/comments/443079946","html_url":"https://github.com/sympy/sympy/pull/15571#issuecomment-443079946","issue_url":"https://api.github.com/repos/sympy/sympy/issues/15571","id":443079946,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzA3OTk0Ng==","user":{"login":"normalhuman","id":13082030,"node_id":"MDQ6VXNlcjEzMDgyMDMw","avatar_url":"https://avatars1.githubusercontent.com/u/13082030?v=4","gravatar_id":"","url":"https://api.github.com/users/normalhuman","html_url":"https://github.com/normalhuman","followers_url":"https://api.github.com/users/normalhuman/followers","following_url":"https://api.github.com/users/normalhuman/following{/other_user}","gists_url":"https://api.github.com/users/normalhuman/gists{/gist_id}","starred_url":"https://api.github.com/users/normalhuman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normalhuman/subscriptions","organizations_url":"https://api.github.com/users/normalhuman/orgs","repos_url":"https://api.github.com/users/normalhuman/repos","events_url":"https://api.github.com/users/normalhuman/events{/privacy}","received_events_url":"https://api.github.com/users/normalhuman/received_events","type":"User","site_admin":false},"created_at":"2018-11-30T03:36:19Z","updated_at":"2018-11-30T03:36:19Z","author_association":"CONTRIBUTOR","body":"The test failure comes from the assertion that derivative of `O(x**n)` is `O(x**(n-1))`, which is false as previously mentioned: see the last line here. \r\n\r\nhttps://github.com/sympy/sympy/blob/dc0d6cb29b90c3195fcffd4f6f066e4278122c81/sympy/integrals/tests/test_integrals.py#L1084-L1088\r\n\r\nBut when looking into what the correct behavior should be, I found more troubling things.  \r\n```\r\nfor d in O(x**2).lseries(x):\r\n    print(d)\r\n```\r\nprints 0 and stops. The reason is `removeO` on this line:\r\n\r\nhttps://github.com/sympy/sympy/blob/dc0d6cb29b90c3195fcffd4f6f066e4278122c81/sympy/core/expr.py#L2762\r\n\r\n(But without it, the generator would hang.)  This return of 0 causes the following wrong result: \r\n```\r\n>>> Derivative(O(x**2), x).as_leading_term(x)\r\n0\r\n```\r\nwhich leads to further absurdity.\r\n```\r\n>>> O(x**10).contains(Derivative(O(x**2), x))\r\nTrue\r\n```\r\nA lot of things to straighten out..."}}
{"actor":{"display_login":"normalhuman"}}