{"action":"closed","issue":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/1026","labels_url":"https://api.github.com/repos/chebfun/chebfun/issues/1026/labels{/name}","comments_url":"https://api.github.com/repos/chebfun/chebfun/issues/1026/comments","events_url":"https://api.github.com/repos/chebfun/chebfun/issues/1026/events","html_url":"https://github.com/chebfun/chebfun/issues/1026","id":36684083,"number":1026,"title":"Sum and vscale for functions with endpoint singularities on unbounded domains","user":{"login":"davidagross","id":1645786,"avatar_url":"https://avatars.githubusercontent.com/u/1645786?v=3","gravatar_id":"","url":"https://api.github.com/users/davidagross","html_url":"https://github.com/davidagross","followers_url":"https://api.github.com/users/davidagross/followers","following_url":"https://api.github.com/users/davidagross/following{/other_user}","gists_url":"https://api.github.com/users/davidagross/gists{/gist_id}","starred_url":"https://api.github.com/users/davidagross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidagross/subscriptions","organizations_url":"https://api.github.com/users/davidagross/orgs","repos_url":"https://api.github.com/users/davidagross/repos","events_url":"https://api.github.com/users/davidagross/events{/privacy}","received_events_url":"https://api.github.com/users/davidagross/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chebfun/chebfun/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/chebfun/chebfun/labels/singfun/unbndfun","name":"singfun/unbndfun","color":"660000"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-06-27T16:46:20Z","updated_at":"2015-01-28T16:23:23Z","closed_at":"2015-01-28T16:23:23Z","body":"Based off [another old Trac ticket](https://svn.maths.ox.ac.uk/trac/chebfun/ticket/215) I wanted to check what the current state of the `sum` is by running:\r\n```\r\nf1 = chebfun(@(t) t.^0.5./exp(t), [0,inf], 'exps', [0.5 0])\r\n\r\nf2 = chebfun(@(t) t.^0.5./exp(t), [0,1,inf], 'exps', [0.5 0 0 0])\r\n\r\nf3 = f1; f3(1) = f3(1)\r\n\r\n[sum(f1); sum(f2); sum(f3)]\r\n```\r\nwhich yields:\r\n```\r\nf1 =\r\n \r\n   chebfun column (1 smooth piece)\r\n       interval       length   endpoint values   endpoint exponents\r\n[       0,     Inf]       44         0 -6.7e-16         [0.5      0]  \r\nEpslevel = 1.000000e-14.  Vscale = 2.738613e+00.\r\n\r\n \r\nf2 =\r\n \r\n   chebfun column (2 smooth pieces)\r\n       interval       length   endpoint values   endpoint exponents\r\n[       0,       1]       12         0     0.37         [0.5      0]  \r\n[       1,     Inf]       60      0.37    1e-15         [0      0]  \r\nEpslevel = 1.000000e-14.  Vscale = 7.071068e-01.  Total length = 72.\r\n\r\n \r\nf3 =\r\n \r\n   chebfun column (2 smooth pieces)\r\n       interval       length   endpoint values   endpoint exponents\r\n[       0,       1]    65537   1.2e-05     0.37         [0      0]  \r\n[       1,     Inf]    65537         0 -4.5e-13         [0.5      0]  \r\nEpslevel = 0.  Vscale = Inf.  Total length = 131074.\r\n\r\n\r\nans =\r\n\r\n   0.885858294730405\r\n   0.886226925452745\r\n   0.853327814564061\r\n```\r\n`f1` has the wrong vscale and integral, `f2` has the wrong vscale only, and `f3` has the wrong endpoint values along with the wrong vscale and a wrong-er integral.\r\n\r\nI tracked this down to [`@unbndfun/restrict`](https://github.com/chebfun/chebfun/blob/development/@unbndfun/restrict.m#L83-L89) which needs something like / at least an\r\n```\r\n...\r\nelse\r\n    data.exponents = [];\r\nend\r\n```\r\nto clear the exponents from being erroneously used later in the loop.  Making this change yields:\r\n```\r\nf3 =\r\n \r\n   chebfun column (2 smooth pieces)\r\n       interval       length   endpoint values  \r\n[       0,       1]    65537   1.2e-05     0.37 \r\n[       1,     Inf]       58      0.37 -7.3e-16 \r\nEpslevel = 5.562525e-12.  Vscale = 4.288819e-01.  Total length = 65595.\r\n\r\n\r\nans =\r\n\r\n   0.886226925452732\r\n```\r\nwhich corrects the integral (due to the correction in the endpoint values).  Exponents are still gone, so we're still maxed out at maxLength on the1st (`bndfun`) interval, and this looks like they are [disappearing](https://github.com/chebfun/chebfun/blob/development/@unbndfun/restrict.m#L93) way down in a `smoothfun` constructor, which calls a `chebtech2` constructor that never uses the exponent information.  Also, the vscale is correct.\r\n\r\nThoughts?  I'd be happy to dig deeper and make changes / followed by a pull request but I'd like to learn more about what to do about the exponents and how to keep them around."}}