has_uniroots: Determine whether result(s) of 'uniroots' was successful

View source: R/rootfinding_optimization.R

has_unirootsR Documentation

Determine whether result(s) of uniroots was successful

Description

Determine whether result(s) of uniroots was successful

Usage

has_uniroots(x, tol = .Machine[["double.eps"]]^0.25)

Arguments

x

An object returned from uniroots

tol

A numeric value. The convergence tolerance.

Value

A logical value or a vector of logical values.

Examples

r1 <- uniroots(
  f = function(x) -1 + x^2,
  xlim = c(-10, 10),
  expected_nroots = 2
)

has_uniroots(r1)

r2 <- uniroots(f = function(x) -1 + x^2, xlim = c(-10, -5))
has_uniroots(r2)

r3 <- uniroots(f = function(x) Inf, xlim = c(-10, -5))
has_uniroots(r3)

DrylandEcology/rSW2utils documentation built on Dec. 9, 2023, 10:44 p.m.