{"action":"created","issue":{"url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/216","labels_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/216/labels{/name}","comments_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/216/comments","events_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/216/events","html_url":"https://github.com/QuantEcon/QuantEcon.py/issues/216","id":123938270,"number":216,"title":"Scalar function maximizer","user":{"login":"jstac","id":3887684,"avatar_url":"https://avatars.githubusercontent.com/u/3887684?v=3","gravatar_id":"","url":"https://api.github.com/users/jstac","html_url":"https://github.com/jstac","followers_url":"https://api.github.com/users/jstac/followers","following_url":"https://api.github.com/users/jstac/following{/other_user}","gists_url":"https://api.github.com/users/jstac/gists{/gist_id}","starred_url":"https://api.github.com/users/jstac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstac/subscriptions","organizations_url":"https://api.github.com/users/jstac/orgs","repos_url":"https://api.github.com/users/jstac/repos","events_url":"https://api.github.com/users/jstac/events{/privacy}","received_events_url":"https://api.github.com/users/jstac/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-26T16:37:58Z","updated_at":"2016-01-01T21:54:24Z","closed_at":null,"body":"Adding to wish list: I would like to have a 1D maximization routine in QuantEcon.py, something akin to this SciPy function:\r\n\r\nhttps://github.com/scipy/scipy/blob/v0.16.1/scipy/optimize/optimize.py#L1554\r\n\r\nThe signature would be\r\n\r\n```\r\nimport quantecon as qe\r\nqe.maximize(f, a, b)  # maximize function f on [a, b]\r\n```\r\n\r\nThe algorithm in the link above is Brent's method and I think that would be fine.  Although perhaps it would be nice to have an optional argument ``concave`` that allows users to exploit concavity.\r\n\r\nRationale:\r\n\r\n* Could be written in Cython.  The SciPy version is pure Python.  Cython seems like a better option than Numba because numbafied functions cannot be passed functions as arguments.  Cython functions can be passed functions.\r\n* SciPy and similar libraries only supply minimizers.  With a maximizer code is a bit cleaner.\r\n\r\nNotes: \r\n\r\nI wonder how this would work if it was written in Cython and you passed in numbafied primitives.  For example, if ``f`` was numbafied in the example call given above.  I suspect it would work well."},"comment":{"url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/comments/168340375","html_url":"https://github.com/QuantEcon/QuantEcon.py/issues/216#issuecomment-168340375","issue_url":"https://api.github.com/repos/QuantEcon/QuantEcon.py/issues/216","id":168340375,"user":{"login":"jstac","id":3887684,"avatar_url":"https://avatars.githubusercontent.com/u/3887684?v=3","gravatar_id":"","url":"https://api.github.com/users/jstac","html_url":"https://github.com/jstac","followers_url":"https://api.github.com/users/jstac/followers","following_url":"https://api.github.com/users/jstac/following{/other_user}","gists_url":"https://api.github.com/users/jstac/gists{/gist_id}","starred_url":"https://api.github.com/users/jstac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jstac/subscriptions","organizations_url":"https://api.github.com/users/jstac/orgs","repos_url":"https://api.github.com/users/jstac/repos","events_url":"https://api.github.com/users/jstac/events{/privacy}","received_events_url":"https://api.github.com/users/jstac/received_events","type":"User","site_admin":false},"created_at":"2016-01-01T21:54:24Z","updated_at":"2016-01-01T21:54:24Z","body":"@oyamad Great!  I ran your code with the lastest from Numba and got similar output.\r\n\r\nIt's a shame the `__call__` method doesn't work.  I hope they fix that.  Other than that, it looks like we are close.  I'm very keen to have a jitted scalar maximizer, a minimizer and a root finder in QuantEcon.py.   I know that for me it's going to speed up a lot of my DP routines.\r\n\r\n@albop That's a neat idea.\r\n\r\nActually my main use case (and perhaps other people's too) is maximizing the same function x -> f(x, alpha) with respect to x at many different values of alpha.  So the code @oyamad provided is already very close to what I need.  \r\n\r\n@spencerlyon2 Good to know that these are ready to go on the Julia side.  \r\n\r\n"}}