# MathFun

0th

Percentile

##### Miscellaneous Mathematical Functions

abs(x) computes the absolute value of x, sqrt(x) computes the (principal) square root of x, $\sqrt{x}$.

The naming follows the standard for computer languages such as C or Fortran.

Keywords
math
##### Usage
abs(x)
sqrt(x)
##### Arguments
x
a numeric or complex vector or array.
##### Details

These are internal generic primitive functions: methods can be defined for them individually or via the Math group generic. For complex arguments (and the default method), z, abs(z) == Mod(z) and sqrt(z) == z^0.5.

abs(x) returns an integer vector when x is integer or logical.

##### S4 methods

Both are S4 generic and members of the Math group generic.

##### References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

Arithmetic for simple, log for logarithmic, sin for trigonometric, and Special for special mathematical functions.

plotmath’ for the use of sqrt in plot annotation.

• abs
• sqrt
##### Examples
library(base) require(stats) # for spline require(graphics) xx <- -9:9 plot(xx, sqrt(abs(xx)), col = "red") lines(spline(xx, sqrt(abs(xx)), n=101), col = "pink") 
Documentation reproduced from package base, version 3.2.4, License: Part of R 3.2.4

### Community examples

bdiamond217@gmail.com at Sep 25, 2017 base v3.4.1

## New Example a <- -2 b <- 3 sum_of_absolute_values <- abs(a) + abs(b) print(sum_of_absolute_values)

bdiamond217@gmail.com at Sep 24, 2017 base v3.4.1