{"action":"opened","issue":{"url":"https://api.github.com/repos/chebfun/chebfun/issues/2270","repository_url":"https://api.github.com/repos/chebfun/chebfun","labels_url":"https://api.github.com/repos/chebfun/chebfun/issues/2270/labels{/name}","comments_url":"https://api.github.com/repos/chebfun/chebfun/issues/2270/comments","events_url":"https://api.github.com/repos/chebfun/chebfun/issues/2270/events","html_url":"https://github.com/chebfun/chebfun/issues/2270","id":349024933,"node_id":"MDU6SXNzdWUzNDkwMjQ5MzM=","number":2270,"title":"Bug in lagpts for small n","user":{"login":"nickhale","id":2035010,"node_id":"MDQ6VXNlcjIwMzUwMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/2035010?v=4","gravatar_id":"","url":"https://api.github.com/users/nickhale","html_url":"https://github.com/nickhale","followers_url":"https://api.github.com/users/nickhale/followers","following_url":"https://api.github.com/users/nickhale/following{/other_user}","gists_url":"https://api.github.com/users/nickhale/gists{/gist_id}","starred_url":"https://api.github.com/users/nickhale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickhale/subscriptions","organizations_url":"https://api.github.com/users/nickhale/orgs","repos_url":"https://api.github.com/users/nickhale/repos","events_url":"https://api.github.com/users/nickhale/events{/privacy}","received_events_url":"https://api.github.com/users/nickhale/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-09T08:19:52Z","updated_at":"2018-08-09T08:19:52Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I just discovered the following bug\r\n```\r\n>> lagpts(5) - lagpts(5, 'gw')\r\nans =\r\n  -0.000000000000001\r\n  -0.000000000000001\r\n                   0\r\n   0.000000000000004\r\n  -0.965661467809641\r\n```\r\nSince this (or something similar) occurs for each of the `lagpts` `'method'` options other than `'gw'`, I suspect that the intial guess for this small value is not sufficient for the Newton-like approaches to converge.\r\n\r\nRunning the following, I find it's a problem for `n = 5,6,7,8`. I therefore suggest defaulting to the Golub-Welsch approach when `n <= 10`.\r\n```\r\n>> for k = 1:20, try, err(k) = norm(lagpts(k) - lagpts(k, 'gw'), inf) > 1e-4;, catch err(k) = 1; end, end, err\r\nerr =\r\n     0     0     0     0     1     1     1     1     0     0     0     0     0     0     0     0     0     0     0     0\r\n```\r\n"}}
{"actor":{"display_login":"nickhale"}}