# define the PDF # integrate f over the domain # define the PDF f <- function(x){x/4*exp(-x^2/8)} # integrate f over the domain integrate(f, 0, Inf)$value test_function_definition("f", function_test = { test_expression_result("f(1)") test_expression_result("f(4)") test_expression_result("f(10)") test_expression_result("f(100)") }) test_function("integrate", args = c("f", "lower", "upper"), eval = c(F, T, T)) test_output_contains("1", incorrect_msg = "Did you access the value of the integral?")