[R] Problem with adapt package

Martin Maechler maechler at stat.math.ethz.ch
Fri Jun 29 14:03:50 CEST 2001


>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch> writes:

>>>>> "JonR" == Jonathan Rougier <J.C.Rougier at durham.ac.uk> writes:
    JonR> Hi Anthony,
    JonR> Anthony Tate wrote:
    >>> 
    >>> I am having problems using the adapt add on package to integrate a
    >>> function over 2 dimensions, using the following code.
    >>> 
    >>> library(adapt)
    >>> 
    >>> alb1 <- function(p,X,th,alpha){
    >>> y <- p[1]; z <- p[2]
    >>> c <- sqrt((X + z*tan(th))^2 + z^2)
    >>> r <- sqrt(c^2 + y^2)
    >>> exp(-alpha*r) / r^3
    >>> }
    >>> 
    >>> x <- 0.05
    >>> y <- x
    >>> w <- 0.5
    >>> delta <- 0.1
    >>> czang <- pi/4
    >>> alpha <- 15.0
    >>> y[i] <- adapt(ndim=2, lower=c(0,0), upper=c(w,delta),
    >>> minpts=1000, maxpts=10^6, funct=alb1,  eps=0.005,
    >>> X=x, th=czang, alpha=alpha)$value
    >>> 
    >>> The code gives the following error
    >>> 
    >>> Error in function (p, X, th, alpha)  : Argument "X" is missing, with no default

    JonR> This is a bug that I thought we had squashed.  Crudely there is a
    JonR> "..."  missing in the line "ff<-functn".  I have a feeling that
    JonR> Martin fixed this with some tricky code using ".Alias", but the
    JonR> fix has not appeared on CRAN.  Martin?!

    MM> Yes, this definitely rings a bell!  Indeed I had fixed something
    MM> like that, submitted to Thomas, who had put it into the integrate
    MM> package then.

    MM> "adapt" has been packaged by Brian Ripley and I haven't checked
				  ^^^^^^^^^^^^^^^
all wrong!  I apologize.
B.R. and Thomas Lumley and me were just discussing the topic, 
but Thomas, not Brian volunteered to re-package the adapt() function!
    
    MM>  ...
    MM> Okay, yes, apply (something like) the following patch

    MM>  <...>
    
 (see last message, the patch is fine).


Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list