https://github.com/cran/pracma
Tip revision: 71455748623ef69836470c75c5f9384f6e872d45 authored by HwB on 28 June 2011, 00:00:00 UTC
version 0.6-3
version 0.6-3
Tip revision: 7145574
linspace.R
##
## l i n s p a c e . R
##
linspace <- function(x1, x2, n=100) {
stopifnot(is.numeric(x1), is.numeric(x2), length(x1)==1, length(x2)==1)
n <- floor(n)
if (n <= 1) x2
else seq(x1, x2, length.out=n)
}
logspace <- function(x1, x2, n=50) {
if (x2 == pi) x2 <- log10(x2)
10^linspace(x1, x2, n)
}
logseq <- function(x1, x2, n=100) {
x <- linspace(log(abs(x1)), log(abs(x2)), n)
exp(x)
}