Liking cljdoc? Tell your friends :D
Clojure only.

fastmath.solver.muller

Muller's method for a root of a function on an interval with a sign change, safeguarded by the bracket.

Muller's method fits a parabola through the last three points and moves to its root, which gives a convergence of order about 1.84 and works for a root of even multiplicity or a pair of close roots where the secant method fails. Here the new point is always inside the bracket: a parabola without a root in the bracket, or a step which does not shrink the bracket fast enough, is replaced by a bisection step.

Muller's method for a root of a function on an interval with a sign change, safeguarded by the bracket.

Muller's method fits a parabola through the last three points and moves to its root, which gives a convergence of order about 1.84 and works for a root of even multiplicity or a pair of close roots where the secant method fails. Here the new point is always inside the bracket: a parabola without a root in the bracket, or a step which does not shrink the bracket fast enough, is replaced by a bisection step.
raw docstring

mullerclj

(muller f lower upper)
(muller f lower upper options)

Finds a root of f on [lower, upper] with Muller's method safeguarded by the bracket.

Parameters:

  • f (function): a function of one number returning a number; it has to change the sign on the interval.
  • lower, upper (finite numbers): ends of the interval; reversed ends are swapped.
  • options (map, optional):
    • :absolute-accuracy - absolute tolerance of the root, default 1.0e-300.
    • :relative-accuracy - tolerance relative to the root, default four times the machine epsilon. The root is found within absolute + relative * |root|.
    • :max-iters - limit of function evaluations (an integer), default 1200. Exceeding it throws.
    • :initial-value - the third point of the first parabola, strictly inside the interval, default the middle of the interval.
    • :info? - when truthy, returns the map {:root :evaluations :status} instead of the root, and returns the failure status instead of throwing. Default false.

Returns the root as a double. A root at an end of the interval is returned after at most two evaluations. A negative discriminant or a parabola without a root inside the bracket never produces NaN: a bisection step is made instead.

Throws ex-info for an invalid argument, and for a failed solve: no sign change on the interval (:status :no-bracket), NaN function values (:nan), a non number result (:invalid-result) or the evaluation limit (:max-evals). The data of the exception holds the :status and a few scalars.

See also fastmath.solver/find-root, fastmath.solver.muller2/muller2, fastmath.solver.brent/brent.

Finds a root of `f` on `[lower, upper]` with Muller's method safeguarded by the bracket.

Parameters:

- `f` (function): a function of one number returning a number; it has to change the sign on the interval.
- `lower`, `upper` (finite numbers): ends of the interval; reversed ends are swapped.
- `options` (map, optional):
    - `:absolute-accuracy` - absolute tolerance of the root, default `1.0e-300`.
    - `:relative-accuracy` - tolerance relative to the root, default four times the machine epsilon. The root is found within `absolute + relative * |root|`.
    - `:max-iters` - limit of function evaluations (an integer), default `1200`. Exceeding it throws.
    - `:initial-value` - the third point of the first parabola, strictly inside the interval, default the middle of the interval.
    - `:info?` - when truthy, returns the map `{:root :evaluations :status}` instead of the root, and returns the failure status instead of throwing. Default `false`.

Returns the root as a double. A root at an end of the interval is returned after at most two evaluations. A negative discriminant or a parabola without a root inside the bracket never produces `NaN`: a bisection step is made instead.

Throws `ex-info` for an invalid argument, and for a failed solve: no sign change on the interval (`:status :no-bracket`), `NaN` function values (`:nan`), a non number result (`:invalid-result`) or the evaluation limit (`:max-evals`). The data of the exception holds the `:status` and a few scalars.

See also [[fastmath.solver/find-root]], [[fastmath.solver.muller2/muller2]], [[fastmath.solver.brent/brent]].
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close