Book Image

NumPy: Beginner's Guide

By : Ivan Idris
Book Image

NumPy: Beginner's Guide

By: Ivan Idris

Overview of this book

Table of Contents (21 chapters)
NumPy Beginner's Guide Third Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
NumPy Functions' References
Index

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:

    vals = np.i0(x)
  3. Plot the modified Bessel function with matplotlib:

    plt.plot(x, vals)
    plt.show()

    The modified Bessel function will have the following output:

What just happened?

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