integrate from 0 to a variable in r

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

integrate from 0 to a variable in r

June_cosmo
I want to integrate from 0 to z where z is a variable. Here is my code:

z <- any_number
integrand <- function(x) {(0.3*(1+x)^3+0.7)^-1/2}
integrate(integrand, lower = 0, upper = z)

but this error appears:

Error: object 'any_number' not found

Error in integrate(integrand, lower = 0, upper = z) : object 'z' not found"

so how do I define z here?

Thanks!!
June