Skip to contents

Element-wise inverse operations on numeric or complex vectors (or objects which can be coerced to them), i.e. 1/x.

Usage

# S3 method for default
inv(x)

Arguments

x

numeric or complex vectors or objects which can be coerced to such, or other objects for which methods have been written.

Value

Vector or array of inverted elements from x.

Details

inv(x) is equivalent to 1/x where / is the default division operator.

From base::Arithmetic: if applied to arrays the result will be an array if this is sensible (for example it will not if the recycling rule has been invoked).

See also

Author

Chloe Serre-Combe, Amelie Vernay

Examples

inv(4)
#> [1] 0.25
inv(1:10)
#>  [1] 1.0000000 0.5000000 0.3333333 0.2500000 0.2000000 0.1666667 0.1428571
#>  [8] 0.1250000 0.1111111 0.1000000