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.



4428 Rate this article:
No rating

Analyzing the Bessel Function of the First Kind with IDL

This Help Article discusses "Analyzing the Bessel Function of the First Kind."

Determining Bessel Function Accuracy. A recurrence relationship between Bessel functions of differing order can be used to determine how accurately IDL is computing Bessel functions.

For Related information, see the following Help Artciles:
“#3184: Analyzing the Bessel Function of the Second Kind”
“#3185: Analyzing the Modified Bessel Function of the First Kind”
“#3186: Analyzing the Modified Bessel Function of the Second Kind”

Analyzing the Bessel Function of the First Kind. In the following example, the recurrence relationship:

bessel1a.jpg

where J(x) is the Bessel function of the first kind of order n - 1, n, or n + 1 is used. Subtracting the Bessel function of order n from both sides results in the following equation.

bessel1.jpg

Evaluating the left side of this equation will reveal how accurately IDL computes the Bessel function of the first kind.

The resulting plots are for n equal to 1 through 6. All of these plots show that this Bessel function is calculated within machine tolerance.

Code example: 

PRO analyzingBESELJ
    ; Derive x values.
    x = (DINDGEN(1000) + 1.)/100.

    ; Initialize display window.
    WINDOW, 0, TITLE = 'Bessel Functions'

    ; Display the first 8 orders of the Bessel function of
    ; the first kind.
    PLOT, x, BESELJ(x, 0), /XSTYLE, /YSTYLE, $
     XTITLE = 'x', YTITLE = 'f(x)', $
     TITLE = 'Bessel Functions of the First Kind'
    OPLOT, x, BESELJ(x, 1), LINESTYLE = 1
    OPLOT, x, BESELJ(x, 2), LINESTYLE = 2
    OPLOT, x, BESELJ(x, 3), LINESTYLE = 3
    OPLOT, x, BESELJ(x, 4), LINESTYLE = 4
    OPLOT, x, BESELJ(x, 5), LINESTYLE = 5
    OPLOT, x, BESELJ(x, 6), LINESTYLE = 0
    OPLOT, x, BESELJ(x, 7), LINESTYLE = 1

    ; Initialize display window for recurrence relations.
    WINDOW, 1, XSIZE = 896, YSIZE = 512, $
     TITLE = 'Testing the Recurrence Relations'
    !P.MULTI = [0, 2, 3, 0, 0]

    ; Initialize title variable.
    nString = ['0', '1', '2', '3', '4', '5', '6', '7']

    ; Display recurrence relationships for order 1 to 6.
    ; NOTE: the results of these relationships should be
    ; very close to zero.
    FOR n = 1, 6 DO BEGIN
     equation = x*(BESELJ(x, (n - 1)) + $
     BESELJ(x, (n + 1))) - 2.*FLOAT(n)*BESELJ(x, n)
     PLOT, x, equation, /XSTYLE, /YSTYLE, CHARSIZE = 1.5, $
     TITLE = 'n = ' + nString[n] + ': Orders of ' + $
     nString[n - 1] + ', ' + nString[n] + ', and ' + $
     nString[n + 1]
     PRINT, 'n = ' + nString[n] + ': '
     PRINT, 'minimum = ', MIN(equation)
     PRINT, 'maximum = ', MAX(equation)
    ENDFOR

    ; Return display window back to its default setting, one
    ; display per window.
    !P.MULTI = 0
 
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 »