{"action":"created","comment":{"url":"https://api.github.com/repos/sympy/sympy/pulls/comments/194965138","pull_request_review_id":128237230,"id":194965138,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDk2NTEzOA==","diff_hunk":"@@ -100,16 +109,43 @@ def compute_characteristic_function(self, **kwargs):\n         cf = summation(exp(I*t*x)*pdf, (x, self.set.inf, self.set.sup))\n         return Lambda(t, cf)\n \n+    def _characteristic_function(self, t):\n+        return None\n+\n     def characteristic_function(self, t, **kwargs):\n         \"\"\" Characteristic function \"\"\"\n+        if not kwargs:\n+            cf = self._characteristic_function(t)\n+            if cf is not None:\n+                return cf\n         return self.compute_characteristic_function(**kwargs)(t)\n \n     def expectation(self, expr, var, evaluate=True, **kwargs):\n         \"\"\" Expectation of expression over distribution \"\"\"\n         # TODO: support discrete sets with non integer stepsizes\n+\n         if evaluate:\n-            return summation(expr * self.pdf(var),\n-                         (var, self.set.inf, self.set.sup), **kwargs)\n+            try:\n+                # note: in order for this algorithm to be valid,\n+                #   the characteristic function must have continuous\n+                #   derivatives up to the highest power of the variable in the expression\n+\n+                t = Symbol('t', real=True, dummy=True)","path":"sympy/stats/drv.py","position":54,"original_position":54,"commit_id":"025a857897fc24dbf0d74773f47443b5b6d20992","original_commit_id":"025a857897fc24dbf0d74773f47443b5b6d20992","user":{"login":"jksuom","id":6929119,"node_id":"MDQ6VXNlcjY5MjkxMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/6929119?v=4","gravatar_id":"","url":"https://api.github.com/users/jksuom","html_url":"https://github.com/jksuom","followers_url":"https://api.github.com/users/jksuom/followers","following_url":"https://api.github.com/users/jksuom/following{/other_user}","gists_url":"https://api.github.com/users/jksuom/gists{/gist_id}","starred_url":"https://api.github.com/users/jksuom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jksuom/subscriptions","organizations_url":"https://api.github.com/users/jksuom/orgs","repos_url":"https://api.github.com/users/jksuom/repos","events_url":"https://api.github.com/users/jksuom/events{/privacy}","received_events_url":"https://api.github.com/users/jksuom/received_events","type":"User","site_admin":false},"body":"`dummy=True` will be ignored. This could be `Dummy('t', real=True)` (or `symbols('t', real=True, cls=Dummy)`).","created_at":"2018-06-13T06:11:29Z","updated_at":"2018-06-13T06:11:30Z","html_url":"https://github.com/sympy/sympy/pull/14539#discussion_r194965138","pull_request_url":"https://api.github.com/repos/sympy/sympy/pulls/14539","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/194965138"},"html":{"href":"https://github.com/sympy/sympy/pull/14539#discussion_r194965138"},"pull_request":{"href":"https://api.github.com/repos/sympy/sympy/pulls/14539"}}},"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/14539","id":175995617,"node_id":"MDExOlB1bGxSZXF1ZXN0MTc1OTk1NjE3","html_url":"https://github.com/sympy/sympy/pull/14539","diff_url":"https://github.com/sympy/sympy/pull/14539.diff","patch_url":"https://github.com/sympy/sympy/pull/14539.patch","issue_url":"https://api.github.com/repos/sympy/sympy/issues/14539","number":14539,"state":"open","locked":false,"title":"Improvements to discrete random variables","user":{"login":"ethankward","id":14932247,"node_id":"MDQ6VXNlcjE0OTMyMjQ3","avatar_url":"https://avatars0.githubusercontent.com/u/14932247?v=4","gravatar_id":"","url":"https://api.github.com/users/ethankward","html_url":"https://github.com/ethankward","followers_url":"https://api.github.com/users/ethankward/followers","following_url":"https://api.github.com/users/ethankward/following{/other_user}","gists_url":"https://api.github.com/users/ethankward/gists{/gist_id}","starred_url":"https://api.github.com/users/ethankward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethankward/subscriptions","organizations_url":"https://api.github.com/users/ethankward/orgs","repos_url":"https://api.github.com/users/ethankward/repos","events_url":"https://api.github.com/users/ethankward/events{/privacy}","received_events_url":"https://api.github.com/users/ethankward/received_events","type":"User","site_admin":false},"body":"Several changes:\r\n\r\n1. Added a new algorithm to compute expectations based on derivatives of the characteristic function.\r\n2. Added four new distributions: logarithmic, negative binomial, Yule-Simon, and zeta\r\n3. Added numeric tests for characteristic functions of DRV's\r\n4. Modified keyword arguments in RV to pass evaluate explicitly and propagated that to the methods for CRV and FRV.\r\n5. Added option to override CDF calculation for DRV's for cases where a simpler expression is  possible without going through summation.","created_at":"2018-03-19T19:01:46Z","updated_at":"2018-06-13T06:11:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"487fd2268f86166a2b47a52eb570b09680d54060","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":84627353,"node_id":"MDU6TGFiZWw4NDYyNzM1Mw==","url":"https://api.github.com/repos/sympy/sympy/labels/NeedsReview","name":"NeedsReview","color":"ededed","default":false},{"id":222869633,"node_id":"MDU6TGFiZWwyMjI4Njk2MzM=","url":"https://api.github.com/repos/sympy/sympy/labels/PR:%20sympy's%20turn","name":"PR: sympy's turn","color":"ffff1a","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/sympy/sympy/pulls/14539/commits","review_comments_url":"https://api.github.com/repos/sympy/sympy/pulls/14539/comments","review_comment_url":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/14539/comments","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/025a857897fc24dbf0d74773f47443b5b6d20992","head":{"label":"ethankward:master","ref":"master","sha":"025a857897fc24dbf0d74773f47443b5b6d20992","user":{"login":"ethankward","id":14932247,"node_id":"MDQ6VXNlcjE0OTMyMjQ3","avatar_url":"https://avatars0.githubusercontent.com/u/14932247?v=4","gravatar_id":"","url":"https://api.github.com/users/ethankward","html_url":"https://github.com/ethankward","followers_url":"https://api.github.com/users/ethankward/followers","following_url":"https://api.github.com/users/ethankward/following{/other_user}","gists_url":"https://api.github.com/users/ethankward/gists{/gist_id}","starred_url":"https://api.github.com/users/ethankward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethankward/subscriptions","organizations_url":"https://api.github.com/users/ethankward/orgs","repos_url":"https://api.github.com/users/ethankward/repos","events_url":"https://api.github.com/users/ethankward/events{/privacy}","received_events_url":"https://api.github.com/users/ethankward/received_events","type":"User","site_admin":false},"repo":{"id":117462894,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc0NjI4OTQ=","name":"sympy","full_name":"ethankward/sympy","owner":{"login":"ethankward","id":14932247,"node_id":"MDQ6VXNlcjE0OTMyMjQ3","avatar_url":"https://avatars0.githubusercontent.com/u/14932247?v=4","gravatar_id":"","url":"https://api.github.com/users/ethankward","html_url":"https://github.com/ethankward","followers_url":"https://api.github.com/users/ethankward/followers","following_url":"https://api.github.com/users/ethankward/following{/other_user}","gists_url":"https://api.github.com/users/ethankward/gists{/gist_id}","starred_url":"https://api.github.com/users/ethankward/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethankward/subscriptions","organizations_url":"https://api.github.com/users/ethankward/orgs","repos_url":"https://api.github.com/users/ethankward/repos","events_url":"https://api.github.com/users/ethankward/events{/privacy}","received_events_url":"https://api.github.com/users/ethankward/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ethankward/sympy","description":"A computer algebra system written in pure Python","fork":true,"url":"https://api.github.com/repos/ethankward/sympy","forks_url":"https://api.github.com/repos/ethankward/sympy/forks","keys_url":"https://api.github.com/repos/ethankward/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethankward/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethankward/sympy/teams","hooks_url":"https://api.github.com/repos/ethankward/sympy/hooks","issue_events_url":"https://api.github.com/repos/ethankward/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/ethankward/sympy/events","assignees_url":"https://api.github.com/repos/ethankward/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/ethankward/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/ethankward/sympy/tags","blobs_url":"https://api.github.com/repos/ethankward/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethankward/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethankward/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethankward/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethankward/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/ethankward/sympy/languages","stargazers_url":"https://api.github.com/repos/ethankward/sympy/stargazers","contributors_url":"https://api.github.com/repos/ethankward/sympy/contributors","subscribers_url":"https://api.github.com/repos/ethankward/sympy/subscribers","subscription_url":"https://api.github.com/repos/ethankward/sympy/subscription","commits_url":"https://api.github.com/repos/ethankward/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethankward/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethankward/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethankward/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethankward/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/ethankward/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethankward/sympy/merges","archive_url":"https://api.github.com/repos/ethankward/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethankward/sympy/downloads","issues_url":"https://api.github.com/repos/ethankward/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/ethankward/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/ethankward/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/ethankward/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethankward/sympy/labels{/name}","releases_url":"https://api.github.com/repos/ethankward/sympy/releases{/id}","deployments_url":"https://api.github.com/repos/ethankward/sympy/deployments","created_at":"2018-01-14T20:09:39Z","updated_at":"2018-06-12T19:46:18Z","pushed_at":"2018-06-12T19:45:43Z","git_url":"git://github.com/ethankward/sympy.git","ssh_url":"git@github.com:ethankward/sympy.git","clone_url":"https://github.com/ethankward/sympy.git","svn_url":"https://github.com/ethankward/sympy","homepage":"http://sympy.org/","size":91009,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sympy:master","ref":"master","sha":"f49ab56be9d6f54e3ccbeed1914d1b2dbce4aecd","user":{"login":"sympy","id":260832,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDgzMg==","avatar_url":"https://avatars1.githubusercontent.com/u/260832?v=4","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"repo":{"id":640534,"node_id":"MDEwOlJlcG9zaXRvcnk2NDA1MzQ=","name":"sympy","full_name":"sympy/sympy","owner":{"login":"sympy","id":260832,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI2MDgzMg==","avatar_url":"https://avatars1.githubusercontent.com/u/260832?v=4","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sympy/sympy","description":"A computer algebra system written in pure Python","fork":false,"url":"https://api.github.com/repos/sympy/sympy","forks_url":"https://api.github.com/repos/sympy/sympy/forks","keys_url":"https://api.github.com/repos/sympy/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sympy/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sympy/sympy/teams","hooks_url":"https://api.github.com/repos/sympy/sympy/hooks","issue_events_url":"https://api.github.com/repos/sympy/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/sympy/sympy/events","assignees_url":"https://api.github.com/repos/sympy/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/sympy/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/sympy/sympy/tags","blobs_url":"https://api.github.com/repos/sympy/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sympy/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sympy/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sympy/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/sympy/sympy/languages","stargazers_url":"https://api.github.com/repos/sympy/sympy/stargazers","contributors_url":"https://api.github.com/repos/sympy/sympy/contributors","subscribers_url":"https://api.github.com/repos/sympy/sympy/subscribers","subscription_url":"https://api.github.com/repos/sympy/sympy/subscription","commits_url":"https://api.github.com/repos/sympy/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sympy/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sympy/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sympy/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sympy/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/sympy/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sympy/sympy/merges","archive_url":"https://api.github.com/repos/sympy/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sympy/sympy/downloads","issues_url":"https://api.github.com/repos/sympy/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/sympy/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/sympy/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/sympy/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sympy/sympy/labels{/name}","releases_url":"https://api.github.com/repos/sympy/sympy/releases{/id}","deployments_url":"https://api.github.com/repos/sympy/sympy/deployments","created_at":"2010-04-30T20:37:14Z","updated_at":"2018-06-12T22:48:07Z","pushed_at":"2018-06-12T22:36:59Z","git_url":"git://github.com/sympy/sympy.git","ssh_url":"git@github.com:sympy/sympy.git","clone_url":"https://github.com/sympy/sympy.git","svn_url":"https://github.com/sympy/sympy","homepage":"http://sympy.org/","size":90980,"stargazers_count":4894,"watchers_count":4894,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2293,"mirror_url":null,"archived":false,"open_issues_count":3340,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2293,"open_issues":3340,"watchers":4894,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/14539"},"html":{"href":"https://github.com/sympy/sympy/pull/14539"},"issue":{"href":"https://api.github.com/repos/sympy/sympy/issues/14539"},"comments":{"href":"https://api.github.com/repos/sympy/sympy/issues/14539/comments"},"review_comments":{"href":"https://api.github.com/repos/sympy/sympy/pulls/14539/comments"},"review_comment":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sympy/sympy/pulls/14539/commits"},"statuses":{"href":"https://api.github.com/repos/sympy/sympy/statuses/025a857897fc24dbf0d74773f47443b5b6d20992"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jksuom"}}