File: logspace.R

package info (click to toggle)
r-cran-matlab 1.0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 640 kB
  • sloc: sh: 13; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
###
### $Id: logspace.R 22 2022-05-30 18:03:47Z proebuck $
###


##-----------------------------------------------------------------------------
test.logspace <- function(input, expected) {
    output <- do.call(getFromNamespace("logspace", "matlab"), input)
    identical(all.equal(output, 
                        expected,
                        tolerance = 0.0001),
              TRUE)
}

logspace.expected.1topi <- c(10.0000, 7.4866, 5.6050, 4.1963, 3.1416)

test.logspace(list(a = 1, b = pi, n = 5), logspace.expected.1topi)

## more rigorously this time
test.logspace(list(a = 0, b = 1, n = 0), 10)        ## HWB 2011/02/03
test.logspace(list(a = 0, b = 10, n = 1), 10^10)    ## HWB 2011/02/03
test.logspace(list(a = 0, b = 1, n = 1.5), 10)      ## HWB 2011/02/03