File: test_optimizeSubInts.R

package info (click to toggle)
r-cran-bbmisc 1.7-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,156 kB
  • ctags: 13
  • sloc: ansic: 152; sh: 9; makefile: 3
file content (11 lines) | stat: -rw-r--r-- 243 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
context("optimizeSubInts")

test_that("optimizeSubInts", {

  f = function(x) sin(x) * x
  z = optimizeSubInts(f, interval = c(0, 50), nsub = 200L)
  print(z)
  fopt = f(pi * 3 / 2 + 14 * pi)
  expect_true(abs(fopt -  z$objective) < 1e-1)
})