Monday, January 18, 2016

Special functions: Beta


All the elements presented are not warranted to be correct or free from defects. 
Please report any errors found to  afstblogs@gmail.com




Excel formulas and user defined functions




' Beta function
Function xlBETA(a, b)
  With WorksheetFunction
    xlBETA = Exp(.GammaLn_Precise(a) _
      + .GammaLn_Precise(b) _
      - .GammaLn_Precise(a + b))
  End With
End Function

Matlab


>> a=(0.5:5)',b=(0.5:5)',beta(a,b)
a =
                       0.5
                       1.5
                       2.5
                       3.5
                       4.5
b =
                       0.5
                       1.5
                       2.5
                       3.5
                       4.5
ans =
          3.14159265358979
         0.392699081698724
        0.0736310778185108
        0.0153398078788564
       0.00335558297349984


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.