Time for action – plotting the modified Bessel function

Let's see what the modified Bessel function of the first kind 0th order looks like:

  1. Compute evenly spaced values with the NumPy linspace function.
    x = np.linspace(0, 4, 100)
  2. Call the NumPy i0 function to calculate the function values.
    vals = np.i0(x)
  3. Plot the modified Bessel function with Matplotlib.
    plot(x, vals)
    show()

    The modified Bessel function would have the following output:

    Time for action – plotting the modified Bessel function

What just happened?

We plotted the modified Bessel function of the first kind 0th order with the NumPy i0 function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset