Mastering Python Scientific Computing
eBook - ePub

Mastering Python Scientific Computing

Hemant Kumar Mehta

Share book
  1. 300 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering Python Scientific Computing

Hemant Kumar Mehta

Book details
Book preview
Table of contents
Citations

About This Book

A complete guide for Python programmers to master scientific computing using Python APIs and tools

About This Book

  • The basics of scientific computing to advanced concepts involving parallel and large scale computation are all covered.
  • Most of the Python APIs and tools used in scientific computing are discussed in detail
  • The concepts are discussed with suitable example programs

Who This Book Is For

If you are a Python programmer and want to get your hands on scientific computing, this book is for you. The book expects you to have had exposure to various concepts of Python programming.

What You Will Learn

  • Fundamentals and components of scientific computing
  • Scientific computing data management
  • Performing numerical computing using NumPy and SciPy
  • Concepts and programming for symbolic computing using SymPy
  • Using the plotting library matplotlib for data visualization
  • Data analysis and visualization using Pandas, matplotlib, and IPython
  • Performing parallel and high performance computing
  • Real-life case studies and best practices of scientific computing

In Detail

In today's world, along with theoretical and experimental work, scientific computing has become an important part of scientific disciplines. Numerical calculations, simulations and computer modeling in this day and age form the vast majority of both experimental and theoretical papers. In the scientific method, replication and reproducibility are two important contributing factors. A complete and concrete scientific result should be reproducible and replicable. Python is suitable for scientific computing. A large community of users, plenty of help and documentation, a large collection of scientific libraries and environments, great performance, and good support makes Python a great choice for scientific computing.

At present Python is among the top choices for developing scientific workflow and the book targets existing Python developers to master this domain using Python. The main things to learn in the book are the concept of scientific workflow, managing scientific workflow data and performing computation on this data using Python.

The book discusses NumPy, SciPy, SymPy, matplotlib, Pandas and IPython with several example programs.

Style and approach

This book follows a hands-on approach to explain the complex concepts related to scientific computing. It details various APIs using appropriate examples.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering Python Scientific Computing an online PDF/ePUB?
Yes, you can access Mastering Python Scientific Computing by Hemant Kumar Mehta in PDF and/or ePUB format, as well as other popular books in Business & Business Intelligence. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781783288823
Edition
1

Mastering Python Scientific Computing


Table of Contents

Mastering Python Scientific Computing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. The Landscape of Scientific Computing – and Why Python?
Definition of scientific computing
A simple flow of the scientific computation process
Examples from scientific/engineering domains
A strategy for solving complex problems
Approximation, errors, and associated concepts and terms
Error analysis
Conditioning, stability, and accuracy
Backward and forward error analysis
Is it okay to ignore these errors?
Computer arithmetic and floating-point numbers
The background of the Python programming language
The guiding principles of the Python language
Why Python for scientific computing?
Compact and readable code
Holistic language design
Free and open source
Language interoperability
Portable and extensible
Hierarchical module system
Graphical user interface packages
Data structures
Python's testing framework
Available libraries
The downsides of Python
Summary
2. A Deeper Dive into Scientific Workflows and the Ingredients of Scientific Computing Recipes
Mathematical components of scientific computations
A system of linear equations
A system of nonlinear equations
Optimization
Interpolation
Extrapolation
Numerical integration
Numerical differentiation
Differential equations
The initial value problem
The boundary value problem
Random number generator
Python scientific computing
Introduction to NumPy
The SciPy library
The SciPy Subpackage
Data analysis using pandas
A brief idea of interactive programming using IPython
IPython parallel computing
IPython Notebook
Symbolic computing using SymPy
The features of SymPy
Why SymPy?
The plotting library
Summary
3. Efficiently Fabricating and Managing Scientific Data
The basic concepts of data
Data storage software and toolkits
Files
Structured files
Unstructured files
Database
Possible operations on data
Scientific data format
Ready-to-use standard datasets
Data generation
Synthetic data generation (fabrication)
Using Python's built-in functions for random number generation
Bookkeeping functions
Functions for integer random number generation
Functions for sequences
Statistical-distribution-based functions
Nondeterministic random number generator
Designing and implementing random number generators based on statistical distributions
A program with simple logic to generate five-digit random numbers
A brief note about large-scale datasets
Summary
4. Scientific Computing APIs for Python
Numerical scientific computing in Python
The NumPy package
The ndarrays data structure
File handling
Some sample NumPy programs
The SciPy package
The optimization package
The interpolation package
Integration and differential equations in SciPy
The stats module
Clustering package and spatial algorithms in SciPy
Image processing in SciPy
Sample SciPy programs
Statistics using SciPy
Optimization in SciPy
Image processing using SciPy
Symbolic computations using SymPy
Computer Algebra System
Features of a general-purpose CAS
A brief idea of SymPy
Core capability
Polynomials
Calculus
Solving equations
Discrete math
Matrices
Geometry
Plotting
Physics
Statistics
Printing
SymPy modules
Simple exemplary programs
Basic symbol manipulation
Expression expansion in SymPy
Simplification of an expression or formula
Simple integrations
APIs and toolkits for data analysis and visualization
Data analysis and manipulation using pandas
Important data structures of pandas
Special features of pandas
Data visualization using matplotlib
Interactive computing in Python using IPython
Sample data analysis and visualization programs
Summary
5. Performing Numerical Computing
The NumPy fundamental objects
The ndarray object
The attributes of an array
Basic operations on arrays
Special operations on arrays (shape change and conversion)
Classes associated with arrays
The matrix sub class
Masked array
The structured/recor array
The universal function object
Attributes
Methods
Various available ufunc
The NumPy mathematical modules
Introduction to SciPy
Mathematical functions in SciPy
Advanced modules/packages
Integration
Signal processing (scipy.signal)
Fourier transforms (scipy.fftpack)
Spatial data structures and algorithms (scipy.spatial)
Optimization (scipy.optimize)
Interpolation (scipy.interpolate)
Linear algebra (scipy.linalg)
Sparse eigenvalue problems with ARPACK
Statistics (scipy.stats)
Multidimensional image processing (scipy.ndimage)
Clustering
Curve fitting
File I/O (scipy.io)
Summary
6. Applying Python for Symbolic Computing
Symbols, expressions, and basic arithmetic
Equation solving
Functions for rational numbers, exponentials, and logarithms
Polynomials
Trigonometry and complex numbers
Linear algebra
Calculus
Vectors
The physics module
Hydrogen wave functions
Matrices and Pauli algebra
The quantum harmonic oscillator in 1-D and 3-D
Second quantization
High-energy Physics
Mechanics
Pretty printing
LaTeX Printing
The cryptography module
Parsing input
The logic module
The geometry module
Symbolic integrals
Polynomial manipulation
Sets
The simplify and collect operations
Summary
7. Data Analysis and Visualization
Matplotlib
The architecture of matplotlib
The scripting layer (pyplot)
The artist layer
The backend layer
Graphics with matplotlib
Output generation
The pandas library
Series
DataFrame
Panel
The common functionality among the data structures
Time series and date functions
Handling missing data
I/O operations
Working on CSV files
Ready-to-eat datasets
The pandas plotting
IPython
The IPython console and system shell
The operating system interface
Nonblocking plotting
Debugging
IPython Notebook
Summary
8. Parallel and Large-scale Scientific Computing
Parallel computing using IPython
The architecture of IPython parallel computing
The components of parallel computing
The IPython engine
The IPython controller
IPython view and interfaces
The IPython client
Example of performing parallel computing
A parallel decorator
IPython's magic functions
Activating specific views
Engines and QtConsole
Advanced features of IPython
Fault-tolerant execution
Dynamic load balancing
Pushing and pulling objects between clients and engines
Database support for storing the requests and results
Using MPI in IPython
Managing dependencies among tasks
Functional dependency
Decorators for functional dependency
Graph dependency
Impossible dependencies
The DAG dependency and the NetworkX library
Using IPython on an Amazon EC2 cluster with StarCluster
A note on security of IPython
Well-known parallel programming styles
Issues in parallel programming
Parallel programming
Concurrent programming
Distributed programming
Multiprocessing in Python
Multithreading in Python
Hadoop-based MapReduce in Python
Spark in Python
Summary
9. Revisiting Real-life Case Studies
Scientific computing applications developed in Python
The one Laptop per Child project used Python for their user interface
ExpEYES – eyes for science...

Table of contents