Statsar Statistics Library

v1.0.1 for .NET

Product Guide



More Information...

Valid XHTML


Special Functions Example (VB.NET)

[VB.NET]
' COPYRIGHT(C), SIMPLEXAR SOFTWARE LIMITED, 2006-2008.
' All rights reserved.
'
' Use of this copyright notice is precautionary only, and does not imply
' publication or disclosure. The content of this work contains confidential
' and proprietary information of Simplexar Software Limited. Any duplication,
' modification, distribution, or disclosure in any form, in whole, or in part,
' is strictly prohibited without express prior written permission.

' Get namespaces.
Imports System
Imports Simplexar.Statsar

' Start namespace.
Namespace Simplexar.Examples.Statsar

    ' This example uses the statistics calculator to evaluate
    ' special functions (e.g. binomial coefficients and gamma functions).
    Module Example

        ' The application entry point.
        Public Sub Main()
            Try
                RunExample()
            Catch exception As Exception
                Console.WriteLine(exception)
            End Try
            Console.WriteLine("Press ENTER to terminate.")
            Console.ReadLine()
        End Sub

        Private Sub RunExample()

            ' Create a calculator.
            Dim calculator As New StatsCalculator()

            ' Evaluate special functions.
            Console.WriteLine("Factorial(3) = {0}", _
                calculator.Factorial(3))

            Console.WriteLine("LogFactorial(50) = {0}", _
                calculator.LogFactorial(50))

            Console.WriteLine("Binomial(5, 3) = {0}", _
                calculator.Binomial(5, 3))

            Console.WriteLine("LogBinomial(13, 6) = {0}", _
                calculator.LogBinomial(13, 6))

            Console.WriteLine("Gamma(-3.5) = {0}", _
                calculator.Gamma(-3.5))

            Console.WriteLine("LogGamma(4.5) = {0}", _
                calculator.LogGamma(4.5))

            Console.WriteLine("IncompleteGammaP(3.6, 6.4) = {0}", _
                calculator.IncompleteGammaP(3.6, 6.4))

            Console.WriteLine("IncompleteGammaQ(2.4, 4.6) = {0}", _
                calculator.IncompleteGammaQ(2.4, 4.6))

            Console.WriteLine("Beta(0.5, 0.6) = {0}", _
                calculator.Beta(0.5, 0.6))

            Console.WriteLine("LogBeta(-3.5, 12) = {0}", _
                calculator.LogBeta(-3.5, 12))

            Console.WriteLine("IncompleteBeta(0.3, 0.5, 0.8) = {0}", _
                calculator.IncompleteBeta(0.3, 0.5, 0.8))

            Console.WriteLine("Erf(-0.8) = {0}", _
                calculator.Erf(-0.8))

        End Sub

    End Module

End Namespace