X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



4073 Rate this article:
No rating

Calculating Incomplete Beta Functions with IDL

 

Tolerance controls allow you to calculate the accuracy of the incomplete beta and gamma functions. See the Help Article #3182 for calculating Incomplete Gamma Functions.

Working With Tolerances in the Incomplete Beta Function: this example shows the difference in accuracy between the incomplete beta function computed with a low tolerance and the incomplete beta function computed with a high tolerance. The resulting surfaces show the relative errors of each. The relative error of the low tolerance ranges from 0 to 0.00002 percent. The relative error of the high tolerance ranges from 0 to 0.00000000008 percent.

More accuracy usually provides better results, but can cause slower computation speeds. If faster speeds are important, a less accurate calculation may be more desirable. This trade-off can be maintained through tolerances. Iteration controls allow you to expand the computation enough to converge to a result. Calculation of these functions may not converge to a result within the default number of iterations. If the number of iterations is increased, the calculation may converge.

 

Code Example: 

PRO usingIBETAwithEPS    
    ; Define an array of parametric exponents.
    parameterA = (DINDGEN(101)/100. + 1.D) # REPLICATE(1.D, 101)
    parameterB = REPLICATE(1.D, 101) # (DINDGEN(101)/10. + 1.D)

    ; Define the upper limits of integration.
    upperLimits = REPLICATE(0.1D, 101, 101)

    ; Compute the incomplete beta functions.
    betaFunctions = IBETA(parameterA, parameterB, $
     upperLimits)

    ; Compute the incomplete beta functions with a less
    ; accurate tolerance set.
    laBetaFunctions = IBETA(parameterA, parameterB, $
     upperLimits, EPS = 3.0e-4)

    ; Compute relative error.
    relativeError = 100.* $
     ABS((betaFunctions - laBetaFunctions)/betaFunctions)

    ; Display resulting relative error.
    WINDOW, 0, TITLE = 'Compare IBETA with Less Accurate EPS'
    SURFACE, relativeError, parameterA, parameterB, $
     /XSTYLE, /YSTYLE, TITLE = 'Relative Error', $
     XTITLE = 'Parameter A', YTITLE = 'Parameter B', $
     ZTITLE = 'Percent Error (%)', CHARSIZE = 1.5

    ; Compute the incomplete beta functions with a more
    ; accurate tolerance set.
    maBetaFunctions = IBETA(parameterA, parameterB, $
     upperLimits, EPS = 3.0e-10)

    ; Compute relative error.
    relativeError = 100.* $
     ABS((betaFunctions - maBetaFunctions)/betaFunctions)

    ; Display resulting relative error.
    WINDOW, 1, TITLE = 'Compare IBETA with More Accurate EPS'
    SURFACE, relativeError, parameterA, parameterB, $
     /XSTYLE, /YSTYLE, TITLE = 'Relative Error', $
     XTITLE = 'Parameter A', YTITLE = 'Parameter B', $
     ZTITLE = 'Percent Error (%)', CHARSIZE = 1.5
 
END
_______________________________________________________
Reviewed by BC on 09/05/2014
Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »