[R] Integration of functions with a vector argument
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Thu Jun 20 19:09:54 CEST 2024
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> 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> wrote:
>
>> В Tue, 18 Jun 2024 23:12:03 +0000
>> "Levine, Michael" <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 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list