I read the documentation of Mathdotnet but is unintelligible. I don't understand how to use it at all. I would like to integrate the density function of a gamma distribution to get a conditionnal expectation.
I found this exemple in C# but it does not work in VB. To compare with the exemple above, I would like to do something like this:
MathNet.Numerics.Integrate.OnClosedInterval(x >= Gamma.PDF(alpha, beta, x), 0, p / 100)
What would be the equivalent in VB?
If I am getting your question correct then I will suggest there should be lambda expression symbol (=>
) in your code (I tried to edit it but it was rejected)
MathNet.Numerics
and MathNet.Numerics.Distributions
Namespaces. For that you have to download it. OnClosedInterval()
so you have to do like Function(a)
in vb.netyour vb.net code can be like this,
Imports System
Imports MathNet.Numerics
Imports MathNet.Numerics.Distributions
Public Module Module1
Public Sub Main()
Console.WriteLine(Integrate.OnClosedInterval(Function(a) Gamma.PDF(alpha, beta, a), 0, p/100))
End Sub
End Module
You can see example here