integg <- function(t,a,b){
integrate(Vectorize(function(x){55}),lower=t-(a+b),upper=t-a)
}
I’m having what I think may be a simple problem.
I am integrating a constant over bounds that may vary.
If you were to think of this constant as a function, it only exists for values on the x-axis that are >= 0. I cant just set the lower bound == 0. Because there may be times when the lower bound is some value > 0.
It would probably be best to just write the constant as a function somehow.
A second problem I’m having is that I would like to make that value 55 as an object (x) which I can include as an argument to the function integg()
I am using Vectorize because that’s the only way I know how to integrate constants.
Why not do exactly as you describe. Add
xas an argument to yourinteggfunctionYou could just write your own area calc if the function you’re integrating is always constant: