[R] Integration of functions with a vector argument
Levine, Michael
m|ev|n@ @end|ng |rom purdue@edu
Sun Jun 23 23:31:41 CEST 2024
Dear Bert,
Thank you very much for your suggestions!
Yours sincerely,
Michael
Michael Levine
Associate Professor, Statistics
Department of Statistics
Purdue University
250 North University Street
West Lafayette, IN 47907 USA
email: mlevins using purdue.edu
Phone: +1-765-496-7571
Fax: +1-765-494-0558
URL: www.stat.purdue.edu/~mlevins
________________________________
From: Bert Gunter <bgunter.4567 using gmail.com>
Sent: Thursday, June 20, 2024 1:09 PM
To: Ivan Krylov <ikrylov using disroot.org>
Cc: Levine, Michael <mlevins using purdue.edu>; r-help using r-project.org <r-help using r-project.org>
Subject: Re: [R] Integration of functions with a vector argument
You don't often get email from bgunter.4567 using gmail.com. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
---- External Email: Use caution with attachments, links, or sharing data ----
The calculus package might also be relevant (not sure if it was in the Task View):
https://cran.r-project.org/web/packages/calculus/index.html
-- Bert
On Thu, Jun 20, 2024 at 10:01 AM Bert Gunter <bgunter.4567 using gmail.com<mailto:bgunter.4567 using gmail.com>> wrote:
If you haven't already done so, you may wish to have a look here:
https://cran.r-project.org/web/views/NumericalMathematics.html#differentiation-and-integration
(Or perhaps in other related subtopics in the Numerical Math task view)
Cheers,
Bert
On Thu, Jun 20, 2024 at 8:37 AM Ivan Krylov via R-help <r-help using r-project.org<mailto:r-help using r-project.org>> wrote:
В Tue, 18 Jun 2024 23:12:03 +0000
"Levine, Michael" <mlevins using purdue.edu<mailto:mlevins using purdue.edu>> пишет:
> I have heard of several packages used for numerical integration in R -
> cubature that you mentioned, mvQuad, and pracma. My impression is
> that you think that Cubature is the best in your opinion. Is that so?
Yes, but the preference is not very strong. My own numerical
integration experience is limited to using QUADPACK in a project where
everything had to be rewritten in Fortran for speed.
I trust the code of the 'cubature' library by Steven G. Johnson (whose
work includes FFTW and NLopt) and the 'Cuba' library by Thomas Hahn.
The 'cubature' R package wraps these two libraries. Unfortunately, as
you see, its documentation can be lacking.
Like 'cubature', the 'mvQuad' package won't require a significant
rewrite of the integrand because it expects its functions to take
matrices of arguments. Unfortunately, the two packages differ in the
meanings they assign to the matrices: in 'cubature', individual
arguments of the function correspond to the rows of the first argument,
while in 'mvQuad', they must be in the columns.
The 'mvQuad' package requires manual adjustments to the generated
quadratures using rescale(...), which may be not very convenient.
The 'pracma' package contains implementations of a lot of excellent
methods (I've trusted it before for its other functions), but the (two-
or three-argument) integrand will have to be rewritten to accept
separate arrays (of arbitrary shape?) instead of a single matrix.
> If yes, do you know of any detailed discussion of this package beyond
> the two vignettes available on CRAN?
I don't know how much it can help, but more information about the
underlying code for 'cubature' can be found at
<https://github.com/stevengj/cubature> and <https://feynarts.de/cuba/>.
--
Best regards,
Ivan
______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]
More information about the R-help
mailing list