scijs/minimize-golden-section-1d

Name: minimize-golden-section-1d

Owner: scijs

Description: Minimize a function of a single variable using golden section search

Created: 2016-05-09 06:22:53.0

Updated: 2018-03-20 00:44:16.0

Pushed: 2017-06-23 01:05:54.0

Homepage: null

Size: 10

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

minimize-golden-section-1d

Build Status npm version Dependency Status js-semistandard-style

Minimize a function of a single variable using golden section search

Introduction

Returns the argument that minimizes a function of a single variable using golden section search, a search algorithm similar to bisection search except that the size of the intervals is chosen so that function evaluations can be reused more effectively. The golden section works fine with discontinuities, asymptotes, or oscillations that would throw off derivative-based methods but is somewhat slower to converge, likely requiring more function evaluations.

Installation
m install minimize-golden-section-1d
Example

Returns the argument that minimizes the function:

minimize = require('minimize-golden-section-1d');

mize(Math.cos)
> 3.1415926622945616

mize(Math.cos, {lowerBound: 0, upperBound: 1});
> 1

mize(Math.cos, {guess: -3});
> -3.1415926432597825
Usage
require('minimize-golden-section-1d')(f[, options])

Given function f of one Number-valued variable, computes a local minimum. On successful completion, returns the value of the argument that minimizes f (note that this may either be a local or global minimum in the provided range). If the algorithm fails (e.g. NaN encountered or unconstrained divergence of the argument to Infinity), returns NaN. If tolerance is not met, returns best answer.

If bounds are provided, this module proceeds immediately with golden section search. If upper, lower or both bounds are not provided, the algorithm will make use of an initial guess (a provided guess or just one of the bounds if that's all it has) and expand the search range until a minimum is bracketed.

Options:
License

© 2015 Scijs. MIT License.

Authors

Ricky Reusser


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.