From ehlers at math.ucalgary.ca  Sat Nov 26 00:26:26 2005
From: ehlers at math.ucalgary.ca (P Ehlers)
Date: Fri, 25 Nov 2005 16:26:26 -0700
Subject: [Rd] "integrate" error using a constant function (PR#8348)
In-Reply-To: <20051125213847.8BA0F103B2@slim.kubism.ku.dk>
References: <20051125213847.8BA0F103B2@slim.kubism.ku.dk>
Message-ID: <43879DA2.2090701@math.ucalgary.ca>

Did you check the examples on the help page for integrate?

integrand <- function(x) rep(5, length(x))

should do it. Definitely not a bug.

Peter

joelpf at u.washington.edu wrote:

> Full_Name: Joel Franklin
> Version: 2.2.0
> OS: WinXP-Prof
> Submission from: (NULL) (63.226.223.22)
> 
> 
> The "integrate" function, when evaluating an integrand function that is constant
> (therefore not a function of the integral) cannot be valuated, and instead
> throws an error. Instead, the interate function should evaluate the constant
> function as a rectangular area with length (upper-lower).
> 
> For example:
> 
> integrand<-function(x){5}
> integrate(f=integrand,lower=1,upper=5)
> 
> "Error in integrate(f = integrand, lower = 1, upper = 5) : 
>         evaluation of function gave a result of wrong length"
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Ehlers
Department of Mathematics and Statistics
University of Calgary, 2500 University Dr. NW       ph: 403-220-3936
Calgary, Alberta  T2N 1N4, CANADA                  fax: 403-282-5150



[Rd] "integrate" error using a constant function (PR#8348)
P Ehlers