▲ | wjholden 6 days ago | |||||||
I was always amazed that R can do:
Can we do the same in this library? | ||||||||
▲ | legobmw99 6 days ago | parent | next [-] | |||||||
It seems like it is lacking the functionality R's integrate has for handling infinite boundaries, but I suppose you could implement that yourself on the outside. For what it's worth,
prints Result: Ok(1.000000000053865)It does seem to be a usability hazard that the function being integrated is defined as a fn, rather than a Fn, as you can't pass closures that capture variables, requiring the weird dnorm definition | ||||||||
▲ | antononcube 6 days ago | parent | prev | next [-] | |||||||
You will be completely blown away, then, from what Wolfram Language (aka Mathematica) can do. (When it comes to numerical integration.) https://reference.wolfram.com/language/tutorial/NIntegrateOv... | ||||||||
▲ | mtantaoui 6 days ago | parent | prev | next [-] | |||||||
for ]-inf, inf[ integrals, you can use Gauss Hermite method, just keep in mind to multiply your function with exp(x^2).
I got Result: 1.0000000183827922. | ||||||||
▲ | Buttons840 6 days ago | parent | prev [-] | |||||||
How many evaluations of the underlying function does it make? (Hoping someone will fire up their R interpreter and find out.) Or, probably, dnorm is a probability distribution which includes a likeliness function, and a cumulative likeliness function, etc. I bet it doesn't work on arbitrary functions. | ||||||||
|