Skip to content

Scalar function maximizer #216

Open
Open
@jstac

Description

@jstac

Adding to wish list: I would like to have a 1D maximization routine in QuantEcon.py, something akin to this SciPy function:

https://github.com/scipy/scipy/blob/v0.16.1/scipy/optimize/optimize.py#L1554

The signature would be

import quantecon as qe
qe.maximize(f, a, b)  # maximize function f on [a, b]

The 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.

Rationale:

  • 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.
  • SciPy and similar libraries only supply minimizers. With a maximizer code is a bit cleaner.

Notes:

I 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions