From baptiste.auguie at gmail.com  Tue Mar 29 08:31:02 2016
From: baptiste.auguie at gmail.com (Baptiste Auguie)
Date: Tue, 29 Mar 2016 19:31:02 +1300
Subject: [Rd] documentation / warning when passing a vector as lower/upper
	bound in stats::integrate()
Message-ID: <CANLFJPqvvakRJDL7yL+47UD34sicsBWBBAmJi0mSMz7oqRGuTA@mail.gmail.com>

Dear R-dev list,

I wonder if stats::integrate shouldn't warn the user when a numeric vector
of length > 1 is passed as lower or upper bounds. If a vector is passed,
only the first value is used and the others are silently ignored:

integrate(sin, lower=0, upper=pi)
integrate(sin, lower=0:10, upper=pi)

?integrate doesn't appear to mention explicitly that the function is not
vectorised over those arguments.

It's probably not a common mistake, but it can have unfortunate
consequences in the iterative calculation of multiple integrals. Someone
was puzzled by this today (http://stackoverflow.com/q/36275909/471093) and
it wasn't immediately obvious what had led to incorrect results (and worse,
it could have gone unnoticed).

Best regards,

baptiste

	[[alternative HTML version deleted]]



[Rd] documentation / warning when passing a vector as lower/upper bound in stats::integrate()
Baptiste Auguie