exphp | R Documentation |
These functions define the power hyperbola exphp
and the associated
power hyperbolic cosine, sine, tangent, secant, cosecant, cotangent.
They are similar to the traditional hyperbolic functions with term
x
receiving a nonlinear transformation via the function
kashp
.
exphp(x, k = 1)
coshp(x, k = 1)
sinhp(x, k = 1)
tanhp(x, k = 1)
sechp(x, k = 1)
cosechp(x, k = 1)
cotanhp(x, k = 1)
x |
a numeric value, vector or matrix. |
k |
a numeric value, preferably strictly positive. |
exphp
function is defined for x in (-Inf, +Inf) by:
exphp(x, k) = exp( kashp(x, k) )
= exp( k * asinh(x / 2 / k) )
coshp
function is defined for x in (-Inf, +Inf) by:
coshp(x, k) = cosh( kashp(x, k) )
sinhp
function is defined for x in (-Inf, +Inf) by:
sinhp(x, k) = sinh( kashp(x, k) )
tanhp
function is defined for x in (-Inf, +Inf) by:
tanhp(x, k) = tanh( kashp(x, k) )
sechp
function is defined for x in (-Inf, +Inf) by:
sechp(x, k) = 1 / coshp(x, k)
cosechp
function is defined for x in (-Inf, 0) U (0, +Inf) by:
cosechp(x, k) = 1 / sinhp(x, k)
cotanhp
function is defined for x in (-Inf, 0) U (0, +Inf) by:
cotanhp(x, k) = 1 / tanhp(x, k)
The undesired case k = 0 returns 0 for sinhp and tanhp, 1 for exphp, coshp and sechp, Inf for cosechp and cotanhp.
If k is a vector of length > 1, then the use of the function
outer
is recommanded.
The nonlinear transformation kashp
, the inverse power
hyperbolas and the inverse power hyperbolic functions loghp
.
### Example 1
x <- (-3:3)*3
exphp(x, k = 4)
coshp(x, k = 4)
sinhp(x, k = 4)
tanhp(x, k = 4)
### Example 2 outer + plot(exphp, coshp, sinhp, tanhp)
xmin <- -10
xd <- 0.5
x <- seq(xmin, -xmin, xd) ; names(x) <- x
k <- c(0.6, 1, 1.5, 2, 3.2, 10) ; names(k) <- k
olty <- c(2, 1, 2, 1, 2, 1, 1)
olwd <- c(1, 1, 2, 2, 3, 4, 2)
ocol <- c(2, 2, 4, 4, 3, 3, 1)
op <- par(mfrow = c(2,2), mgp = c(1.5,0.8,0), mar = c(3,3,2,1))
## exphp(x, k)
Texphp <- ts(cbind(outer(-x, k, exphp), "exp(-x/2)" = exp(-x/2)),
start = xmin, deltat = xd)
plot(Texphp, plot.type = "single", ylim = c(0,20),
lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i", xlab = "",
ylab = "", main = "exphp(-x, k)" )
legend("topright", title = expression(kappa), legend = colnames(Texphp),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
## coshp(x, k)
Tcoshp <- ts(cbind(outer(x, k, coshp), "cosh(x/2)" = cosh(x/2)),
start = xmin, deltat = xd)
plot(Tcoshp, plot.type = "single", ylim = c(0,20),
lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i",
xlab = "", ylab = "", main = "coshp(x, k)" )
legend("top", title = expression(kappa), legend = colnames(Tcoshp),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
## sinhp(x, k)
Tsinhp <- ts(cbind(outer(x, k, sinhp), "sinh(x/2)" = sinh(x/2)),
start = xmin, deltat=xd)
plot(Tsinhp, plot.type = "single", ylim = c(-10,10),
lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i",
xlab = "", ylab = "", main = "sinhp(x, k)" )
legend("topleft", title = expression(kappa), legend = colnames(Tsinhp),
inset = 0.02, lty = olty, lwd= olwd, col = ocol, cex = 0.7 )
## tanhp(x, k)
Ttanhp <- ts(cbind(outer(x, k, tanhp), "tanh(x/2)" = tanh(x/2)),
start = xmin, deltat = xd)
plot(Ttanhp, plot.type = "single", ylim = c(-1,1),
lty = olty, lwd = olwd, col = ocol, xaxs = "i", yaxs = "i", xlab = "",
ylab = "", main = "tanhp(x, k)" )
legend("topleft", title = expression(kappa), legend = colnames(Ttanhp),
inset = 0.02, lty = olty, lwd = olwd, col = ocol, cex = 0.7 )
### End Example 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.