I received the solution...
Hi:
This is what David means:
f <- function(x, p) x^p
integrate(f, lower = -1, upper = 1, p = 2)
0.667 with absolute error < 7.4e-15
integrate(f, lower = -1, upper = 1, p = 3)
0 with absolute error < 5.6e-15 # this is correct
--
View this message
If f is a two-parameter function, how can I integrate it with respect to p?
--
View this message in context:
http://r.789695.n4.nabble.com/integrate-one-single-variable-functions-with-constant-parameters-tp3336066p3336693.html
Sent from the R help mailing list archive at Nabble.com.
t; 1.1e-14
,but it doesn't work as the integral of f is evaluated with p=1 (the value
of the global variable p) and not with the value of p=2 when the function
integral is called.
Does anyone knows how can I solve this problem?
Thanks in advance
santiagorf
--
View this message in context
3 matches
Mail list logo