Nothing
context("midpt")
f <- function(x) { x^2 }
expect_equal(midpt(f, 0, 1, m = 10), 1 / 3, 1e-2)
expect_equal(midpt(f, 0, 1, m = 100), 1 / 3, 1e-3)
expect_equal(midpt(f, 0, 1, m = 1000), 1 / 3, 1e-4)
f <- function(x) { 1 / x }
expect_false(isTRUE(all.equal(midpt(f, 1, 10, m = 1000), log(10))))
expect_equal(midpt(f, 1, 10, m = 100), log(10), 1e-3)
expect_equal(midpt(f, 1, 10, m = 1000), log(10), 1e-4)
f <- function(x) { sin(x)^2 + cos(x)^2 }
expect_equal(midpt(f, -pi, pi, m = 10), 2 * pi, 1e-2)
expect_equal(midpt(f, -pi, pi, m = 100), 2 * pi, 1e-3)
expect_equal(midpt(f, -pi, pi, m = 1000), 2 * pi, 1e-4)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.