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.
abs(x)
sqrt(x)
complex
vector or array.Math
group generic.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
.
Arithmetic
for simple, log
for logarithmic,
sin
for trigonometric, and Special
for
special mathematical functions. ‘plotmath’ for the use of sqrt
in plot annotation.
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")
Run the code above in your browser using DataLab