Book Image

NumPy Essentials

By : Leo (Liang-Huan) Chin, Tanmay Dutta, Shane Holloway
Book Image

NumPy Essentials

By: Leo (Liang-Huan) Chin, Tanmay Dutta, Shane Holloway

Overview of this book

In today’s world of science and technology, it’s all about speed and flexibility. When it comes to scientific computing, NumPy tops the list. NumPy gives you both the speed and high productivity you need. This book will walk you through NumPy using clear, step-by-step examples and just the right amount of theory. We will guide you through wider applications of NumPy in scientific computing and will then focus on the fundamentals of NumPy, including array objects, functions, and matrices, each of them explained with practical examples. You will then learn about different NumPy modules while performing mathematical operations such as calculating the Fourier Transform; solving linear systems of equations, interpolation, extrapolation, regression, and curve fitting; and evaluating integrals and derivatives. We will also introduce you to using Cython with NumPy arrays and writing extension modules for NumPy code using the C API. This book will give you exposure to the vast NumPy library and help you build efficient, high-speed programs using a wide range of mathematical features.
Table of Contents (16 chapters)
NumPy Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface

Before we start


As we all know, Fourier analysis expresses a function as a sum of periodic components (a combination of sine and cosine functions) and these components are able to recover the original function. It has great applications in digital signal processing such as filtering, interpolation, and more, so we don't want to talk about Fourier analysis in NumPy without giving details of any application we can use it for. For this, we need a module to visualize it.

Matplotlib is the module we are going to use in this chapter for visualization. Please download and install it from the official website: http://matplotlib.org/downloads.html. Or if you are using Scientific Python distributions such as Anaconda, then matplotlib should already be included.

We are going to write a simple display function called show() to help us with the practice examples in this chapter. The function output will be as shown in the following graph:

The upper plot area shows the original functions (signal), and...