{"action":"created","issue":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/1440","labels_url":"https://api.github.com/repos/chebfun/chebfun/issues/1440/labels{/name}","comments_url":"https://api.github.com/repos/chebfun/chebfun/issues/1440/comments","events_url":"https://api.github.com/repos/chebfun/chebfun/issues/1440/events","html_url":"https://github.com/chebfun/chebfun/issues/1440","id":65662206,"number":1440,"title":"Trigfun 'cumsum'","user":{"login":"jaurentz","id":7694954,"avatar_url":"https://avatars.githubusercontent.com/u/7694954?v=3","gravatar_id":"","url":"https://api.github.com/users/jaurentz","html_url":"https://github.com/jaurentz","followers_url":"https://api.github.com/users/jaurentz/followers","following_url":"https://api.github.com/users/jaurentz/following{/other_user}","gists_url":"https://api.github.com/users/jaurentz/gists{/gist_id}","starred_url":"https://api.github.com/users/jaurentz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaurentz/subscriptions","organizations_url":"https://api.github.com/users/jaurentz/orgs","repos_url":"https://api.github.com/users/jaurentz/repos","events_url":"https://api.github.com/users/jaurentz/events{/privacy}","received_events_url":"https://api.github.com/users/jaurentz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-01T11:19:41Z","updated_at":"2015-04-01T11:45:56Z","closed_at":null,"body":"In the current version of Chebfun the trigtech/cumsum command throws an error if the function\r\nhas a nonzero mean. The line between zero and nonzero mean can be difficult to determine. \r\nConsider the following example:\r\n```matlab\r\n >> f = chebfun([1;0;1],[-1,1],'coeffs','trig'); cumsum(f)    \r\n\r\nans =\r\n\r\n   chebfun column (1 smooth piece)\r\n       interval       length   endpoint values trig\r\n[      -1,       1]        3  -1.6e-16        0 \r\nEpslevel = 2.220446e-16.  Vscale = 5.513289e-01.\r\n\r\n>> g = chebfun([1;1e-14;1],[-1,1],'coeffs','trig'); cumsum(g)\r\nError using trigtech/cumsum>cumsumContinuousDim (line 84)\r\nIndefinite integrals are only possible for TRIGTECH objects with zero mean.\r\n\r\nError in trigtech/cumsum (line 64)\r\n    f = cumsumContinuousDim(f, m);\r\n\r\nError in bndfun/cumsum (line 29)\r\n    g = cumsum(f.onefun);\r\n\r\n\r\nError in chebfun/cumsum>cumsumContinousDim (line 85)\r\n        newFuns = cumsum(f.funs{j});\r\n\r\nError in chebfun/cumsum (line 51)\r\n        f(k) = cumsumContinousDim(f(k), m);\r\n```\r\nEven in this simple example it is not clear what to do. One option might be to\r\nreturn a chebfun instead of an error."},"comment":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/comments/88448458","html_url":"https://github.com/chebfun/chebfun/issues/1440#issuecomment-88448458","issue_url":"https://api.github.com/repos/chebfun/chebfun/issues/1440","id":88448458,"user":{"login":"trefethen","id":3601488,"avatar_url":"https://avatars.githubusercontent.com/u/3601488?v=3","gravatar_id":"","url":"https://api.github.com/users/trefethen","html_url":"https://github.com/trefethen","followers_url":"https://api.github.com/users/trefethen/followers","following_url":"https://api.github.com/users/trefethen/following{/other_user}","gists_url":"https://api.github.com/users/trefethen/gists{/gist_id}","starred_url":"https://api.github.com/users/trefethen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trefethen/subscriptions","organizations_url":"https://api.github.com/users/trefethen/orgs","repos_url":"https://api.github.com/users/trefethen/repos","events_url":"https://api.github.com/users/trefethen/events{/privacy}","received_events_url":"https://api.github.com/users/trefethen/received_events","type":"User","site_admin":false},"created_at":"2015-04-01T11:45:56Z","updated_at":"2015-04-01T11:45:56Z","body":"I've been talking with @jaurentz to understand his concerns here (which were prompted by a test that failed in the branch `feature-prescribed-eps`, namely `trigtech/test_cumsum`).  It seems there are three concerns:\r\n\r\n(A) A user encountering the message above may be bewildered.\r\n\r\nTo address this, I suggest the following.  First of all, `@chebfun/cumsum` currently does not mention that zero mean is needed for `cumsum` applied to a trigfun.  Such a comment must be added.  (There is such a comment in `@trigtech/cumsum`, but users cannot be expected to look there.)\r\n\r\nSecond of all, the error message above could say more: e.g., perhaps\r\n\r\n```\r\nError using trigtech/cumsum>cumsumContinuousDim (line 84)\r\nIndefinite integrals are only possible for TRIGTECH objects with zero mean: see help chebfun/cumsum\r\n```\r\n\r\n(B) The logic of how close to zero counts as a \"zero mean\" may not be optimal.  (In the test mentioned above, the tolerance may be too strict.)\r\n\r\n(C) If the mean is not zero, should we return a chebfun rather than just an error message?"}}