You are previewing Numerical Python : A Practical Techniques Approach for Industry.
O'Reilly logo
Numerical Python : A Practical Techniques Approach for Industry

Book Description

Leverage the numerical and mathematical modules in Python and its Standard Library as well as popular open source numerical Python packages like NumPy, SciPy, SymPy, Matplotlib, Pandas, and more to numerically compute solutions and mathematically model applications in a number of areas like big data, cloud computing, financial engineering, business management and more.

After reading and using Numerical Python, you will have seen examples and case studies from many areas of computing, and gained familiarity with basic computing techniques such as array-based and symbolic computing, all-around practical skills such as visualisation and numerical file I/O, general computational methods such as equation solving, optimization, interpolation and integration, and domain-specific computational problems, such as differential equation solving, data analysis, statistical modeling and machine learning.

Python has gained widespread popularity as a computing language: It is nowadays employed for computing by practitioners in such diverse fields as for example scientific research, engineering, finance, and data analytics. One reason for the popularity of Python is its high-level and easy-to-work-with syntax, which enables the rapid development and exploratory computing that is required in modern computational work.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewer
  9. Introduction
  10. Chapter 1: Introduction to Computing with Python
    1. 1.1 Environments for Computing with Python
    2. 1.2 Python
      1. 1.2.1 Interpreter
    3. 1.3 IPython Console
      1. 1.3.1 Input and Output Caching
      2. 1.3.2 Autocompletion and Object Introspection
      3. 1.3.3 Documentation
      4. 1.3.4 Interaction with the System Shell
      5. 1.3.5 IPython Extensions
      6. 1.3.6 The IPython Qt Console
    4. 1.4 IPython Notebook
      1. 1.4.1 Cell Types
      2. 1.4.2 Editing Cells
      3. 1.4.3 Markdown Cells
      4. 1.4.4 nbconvert
    5. 1.5 Spyder: An Integrated Development Environment
      1. 1.5.1 Source Code Editor
      2. 1.5.2 Consoles in Spyder
      3. 1.5.3 Object Inspector
    6. 1.6 Summary
    7. 1.7 Further Reading
    8. 1.8 References
  11. Chapter 2: Vectors, Matrices, and Multidimensional Arrays
    1. 2.1 Importing NumPy
    2. 2.2 The NumPy Array Object
      1. 2.2.1 Data Types
      2. 2.2.2 Order of Array Data in Memory
    3. 2.3 Creating Arrays
      1. 2.3.1 Arrays Created from Lists and Other Array-like Objects
      2. 2.3.2 Arrays Filled with Constant Values
      3. 2.3.3 Arrays Filled with Incremental Sequences
      4. 2.3.4 Arrays Filled with Logarithmic Sequences
      5. 2.3.5 Mesh-grid Arrays
      6. 2.3.6 Creating Uninitialized Arrays
      7. 2.3.7 Creating Arrays with Properties of Other Arrays
      8. 2.3.8 Creating Matrix Arrays
    4. 2.4 Indexing and Slicing
      1. 2.4.1 One-dimensional Arrays
      2. 2.4.2 Multidimensional Arrays
      3. 2.4.3 Views
      4. 2.4.4 Fancy Indexing and Boolean-valued Indexing
    5. 2.5 Reshaping and Resizing
    6. 2.6 Vectorized Expressions
      1. 2.6.1 Arithmetic Operations
      2. 2.6.2 Elementwise Functions
      3. 2.6.3 Aggregate Functions
      4. 2.6.4 Boolean Arrays and Conditional Expressions
      5. 2.6.5 Set Operations
      6. 2.6.6 Operations on Arrays
    7. 2.7 Matrix and Vector Operations
    8. 2.8 Summary
    9. 2.9 Further Reading
    10. 2.10 References
  12. Chapter 3: Symbolic Computing
    1. 3.1 Importing SymPy
    2. 3.2 Symbols
      1. 3.2.1 Numbers
    3. 3.3 Expressions
    4. 3.4 Manipulating Expressions
      1. 3.4.1 Simplification
      2. 3.4.2 Expand
      3. 3.4.3 Factor, Collect, and Combine
      4. 3.4.4 Apart, Together, and Cancel
      5. 3.4.5 Substitutions
    5. 3.5 Numerical Evaluation
    6. 3.6 Calculus
      1. 3.6.1 Derivatives
      2. 3.6.2 Integrals
      3. 3.6.3 Series
      4. 3.6.4 Limits
      5. 3.6.5 Sums and Products
    7. 3.7 Equations
    8. 3.8 Linear Algebra
    9. 3.9 Summary
    10. 3.10 Further Reading
    11. 3.11 References
  13. Chapter 4: Plotting and Visualization
    1. 4.1 Importing Matplotlib
    2. 4.2 Getting Started
      1. 4.2.1 Interactive and Noninteractive Modes
    3. 4.3 Figure
    4. 4.4 Axes
      1. 4.4.1 Plot Types
      2. 4.4.2 Line Properties
      3. 4.4.3 Legends
      4. 4.4.4 Text Formatting and Annotations
      5. 4.4.5 Axis Properties
    5. 4.5 Advanced Axes Layouts
      1. 4.5.1 Insets
      2. 4.5.2 Subplots
      3. 4.5.3 Subplot2grid
      4. 4.5.4 GridSpec
    6. 4.6 Colormap Plots
    7. 4.7 3D plots
    8. 4.8 Summary
    9. 4.9 Further Reading
    10. 4.10 References
  14. Chapter 5: Equation Solving
    1. 5.1 Importing Modules
    2. 5.2 Linear Equation Systems
      1. 5.2.1 Square Systems
      2. 5.2.2 Rectangular Systems
    3. 5.3 Eigenvalue Problems
    4. 5.4 Nonlinear Equations
      1. 5.4.1 Univariate Equations
      2. 5.4.2 Systems of Nonlinear Equations
    5. 5.5 Summary
    6. 5.6 Further Reading
    7. 5.7 References
  15. Chapter 6: Optimization
    1. 6.1 Importing Modules
    2. 6.2 Classification of Optimization Problems
    3. 6.3 Univariate Optimization
    4. 6.4 Unconstrained Multivariate Optimization
    5. 6.5 Nonlinear Least Square Problems
    6. 6.6 Constrained Optimization
      1. 6.6.1 Linear Programming
    7. 6.7 Summary
    8. 6.8 Further Reading
    9. 6.9 References
  16. Chapter 7: Interpolation
    1. 7.1 Importing Modules
    2. 7.2 Interpolation
    3. 7.3 Polynomials
    4. 7.4 Polynomial Interpolation
    5. 7.5 Spline Interpolation
    6. 7.6 Multivariate Interpolation
    7. 7.7 Summary
    8. 7.8 Further Reading
    9. 7.9 References
  17. Chapter 8: Integration
    1. 8.1 Importing Modules
    2. 8.2 Numerical Integration Methods
    3. 8.3 Numerical Integration with SciPy
      1. 8.3.1 Tabulated Integrand
    4. 8.4 Multiple Integration
    5. 8.5 Symbolic and Arbitrary-Precision Integration
    6. 8.6 Integral Transforms
    7. 8.7 Summary
    8. 8.8 Further Reading
    9. 8.9 References
  18. Chapter 9: Ordinary Differential Equations
    1. 9.1 Importing Modules
    2. 9.2 Ordinary Differential Equations
    3. 9.3 Symbolic Solution to ODEs
      1. 9.3.1 Direction Fields
      2. 9.3.2 Solving ODEs using Laplace Transformations
    4. 9.4 Numerical Methods for Solving ODEs
    5. 9.5 Numerical Integration of ODEs using SciPy
    6. 9.6 Summary
    7. 9.7 Further Reading
    8. 9.8 References
  19. Chapter 10: Sparse Matrices and Graphs
    1. 10.1 Importing Modules
    2. 10.2 Sparse Matrices in SciPy
      1. 10.2.1 Functions for Creating Sparse Matrices
      2. 10.2.2 Sparse Linear Algebra Functions
      3. 10.2.3 Linear Equation Systems
    3. 10.3
    4. 10.4 Summary
    5. 10.5 Further Reading
    6. 10.6 References
  20. Chapter 11: Partial Differential Equations
    1. 11.1 Importing Modules
    2. 11.2 Partial Differential Equations
    3. 11.3 Finite-Difference Methods
    4. 11.4 Finite-Element Methods
      1. 11.4.1 Survey of FEM Libraries
    5. 11.5 Solving PDEs using FEniCS
    6. 11.6 Summary
    7. 11.7 Further Reading
    8. 11.8 References
  21. Chapter 12: Data Processing and Analysis
    1. Importing Modules
    2. Introduction to Pandas
      1. Series
      2. DataFrame
      3. Time Series
    3. The Seaborn Graphics Library
    4. Summary
    5. Further Reading
    6. References
  22. Chapter 13: Statistics
    1. Importing Modules
    2. Review of Statistics and Probability
    3. Random Numbers
    4. Random Variables and Distributions
    5. Hypothesis Testing
    6. Nonparametric Methods
    7. Summary
    8. Further Reading
    9. References
  23. Chapter 14: Statistical Modeling
    1. Importing Modules
    2. Introduction to Statistical Modeling
    3. Defining Statistical Models with Patsy
    4. Linear Regression
      1. Example Datasets
    5. Discrete Regression
      1. Logistic Regression
      2. Poisson Model
    6. Time Series
    7. Summary
    8. Further Reading
    9. References
  24. Chapter 15: Machine Learning
    1. Importing Modules
    2. Brief Review of Machine Learning
    3. Regression
    4. Classification
    5. Clustering
    6. Summary
    7. Further Reading
    8. References
  25. Chapter 16: Bayesian Statistics
    1. Importing Modules
    2. Introduction to Bayesian Statistics
    3. Model Definition
      1. Sampling Posterior Distributions
      2. Linear Regression
    4. Summary
    5. Further Reading
    6. References
  26. Chapter 17: Signal Processing
    1. Importing Modules
    2. Spectral Analysis
      1. Fourier Transforms
      2. Windowing
      3. Spectogram
    3. Signal Filters
      1. Convolution Filters
      2. FIR and IIR Filters
    4. Summary
    5. Further Reading
    6. References
  27. Chapter 18: Data Input and Output
    1. Importing Modules
    2. Comma-Separated Values
    3. HDF5
      1. h5py
      2. PyTables
      3. Pandas HDFStore
    4. JSON
    5. Serialization
    6. Summary
    7. Further Reading
    8. References
  28. Chapter 19: Code Optimization
    1. Importing Modules
    2. Numba
    3. Cython
    4. Summary
    5. Further Reading
    6. References
  29. Appendix A Installation
    1. Miniconda and Conda
    2. A Complete Environment
    3. Summary
    4. Further Reading
  30. Index