SciPy - Python Library for Mathematical Functions

This section provides a tutorial example on how to install Python 3 SciPy library on macOS computers. SciPy is widely used by Python users for mathematical functions required in neural network models.

What Is SciPy? SciPy is an open-source Python library for scientific computing developed initially by Travis Oliphant and now maintained by the SciPy community.

If you want to build neural network models in Python, you should install SciPy and get familiar with its functionalities by following this tutorial. This is because neural network models require lots of mathematical functions, which are provided in SciPy.

1. Install SciPy library using the "pip" (Package Installer for Python) command:

herong$ python --version
Python 3.8.0

herong$ sudo pip install scipy
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/...
Installing collected packages: scipy
Successfully installed scipy-1.5.0

3. Verify SciPy installation by importing "scipy" package, retrieving its version string, and calling some statistical functions.

herong$ python
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)

>>> import scipy as sp
>>> sp.v2.14
'1.5.0'

>>> import numpy as np
>>> s = np.random.rand(1000000)

>>> from scipy import stats

>>> stats.tmean(s)
0.5000266615822236

>>> stats.tvar(s)
0.08345433925168123

Note that:

Cool! You have SciPy library ready on your Python environment for scientific computing.

For more readings on SciPy, visit SciPy documentation Website at https://docs.scipy.org/doc/scipy/reference/.

Table of Contents

 About This Book

 Running Python Code Online

 Python on macOS Computers

 Python on Linux Computers

 Built-in Data Types

 Variables, Operations and Expressions

 Statements - Execution Units

 Function Statement and Function Call

 Iterators, Generators and List Comprehensions

 Classes and Instances

 Modules and Module Files

 Packages and Package Directories

 "sys" and "os" Modules

 "pathlib" - Object-Oriented Filesystem Paths

 "pip" - Package Installer for Python

SciPy.org - Python Libraries for Science

 NumPy - Python Library for Matrix operations

SciPy - Python Library for Mathematical Functions

 pandas - Data Analysis and Manipulation

 Anaconda - Python Environment Manager

 Jupyter Notebook and JupyterLab

 References

 Full Version in PDF/EPUB