is.zero: Tests if something is zero or not

Description Usage Arguments Details Value Methods (by class) See Also Examples

Description

Generic function to check if we can treat on object as being zero. For matrices the result is a matrix of the same size.

Usage

1
2
3
4
5
6
7
is.zero(x, eps = ZERO_EPS)

## S4 method for signature 'polynomial'
is.zero(x, eps = ZERO_EPS)

## S4 method for signature 'polyMatrix'
is.zero(x, eps = ZERO_EPS)

Arguments

x

An R object

eps

The minimal numerical value which will not be treated as zero

Details

Different type of objects can be treated as zero in different ways:

By befault eps = {r} ZERO_EPS

Value

TRUE if the object can be treat as zero

Methods (by class)

See Also

zero.round()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# numericals and matrices
is.zero(0)  ## TRUE

is.zero(0.0001, eps=0.01)  ## TRUE

is.zero(c(0, 1, 0))  ## TRUE, FALSE, TRUE

is.zero(matrix(c(1, 9, 0, 0), 2, 2))
## FALSE TRUE
## FALSE TRUE


# polynomials
is.zero(parse.polynomial("0.1 - 0.5 x")) ## FALSE
is.zero(parse.polynomial("0.0001 - 0.0005 x + 0.00002 x^2"), eps=0.01) ## TRUE

polyMatrix documentation built on July 18, 2021, 5:06 p.m.