inverse: Create inverse function

View source: R/pwutilityfunctions.R

inverseR Documentation

Create inverse function

Description

From https://stackoverflow.com/questions/45616072/find-the-inverse-function-in-r

Usage

inverse(fn, interval = NULL, lower = min(interval), upper = max(interval), ...)

Arguments

fn

Monotonous function

interval

Vector defining the domain

lower

Numeric, inferred from interval or given explicitly here

upper

Numeric, inferred from interval or given explicitly here

...

Further parameters to uniroot()

Value

Function (vectorized) computing the inverse of fn

Examples

x <- 1:10
y <- sqrt(x)
sqrt.inv <- inverse(sqrt, lower = 1, upper = 10)
sqrt.inv(y)

powestermark/pwrutilities documentation built on Dec. 28, 2024, 4:44 a.m.