An action packed guide for the easy-to-use, high performance, free open source NumPy mathematical library using real world examples The first and only book that truly explores NumPy practically Perform high performance calculations with clean and efficient NumPy code Analyze large data sets wi
NumPy 1.5 Beginner's Guide
β Scribed by Ivan Idris
- Publisher
- Packt
- Year
- 2011
- Tongue
- English
- Leaves
- 234
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
The book is written in beginner's guide style with each aspect of NumPy demonstrated by real world examples. There is appropriate explained code with the required screenshots thrown in for the novice. This book is for the programmer, scientist or engineer, who has basic Python knowledge and would like to be able to do numerical computations with Python.
β¦ Table of Contents
Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: NumPy Quick Start
Python
Time for action β installing Python on different
operating systems
Windows
Time for action β installing NumPy on Windows
Linux
Time for action β installing NumPy on Linux
Mac OS X
Time for action β installing NumPy on Mac OS X
with a GUI installer
Time for action β installing NumPy with MacPorts or Fink
Building from source
Vectors
Time for action β adding vectors
IPythonβan interactive shell
Online resources and help
Summary
Chapter 2: Beginning with Numpy Fundamentals
NumPy array object
Time for action β creating a multidimensional array
Selecting elements
NumPy numerical types
Data type objects
Character codes
dtype constructors
dtype attributes
Time for action β creating a record data type
One-dimensional slicing and indexing
Time for action β slicing and indexing multidimensional arrays
Time for action β manipulating array shapes
Stacking
Time for action β stacking arrays
Splitting
Time for action β splitting arrays
Array attributes
Time for action β converting arrays
Summary
Chapter 3: Get into Terms with Commonly
Used Functions
File I/O
Time for action β reading and writing files
Identity matrix creation
CSV files
Time for action β loading from CSV files
Volume weighted average price
Time for action β calculating volume weighted average price
The mean function
Time weighted average price
Value range
Time for action β finding highest and lowest values
Statistics
Time for action β doing simple statistics
Stock returns
Time for action β analyzing stock returns
Dates
Time for action β dealing with dates
Weekly summary
Time for action β summarizing data
Average true range
Time for action β calculating the average true range
Simple moving average
Time for action β computing the simple moving average
Exponential moving average
Time for action β calculating the exponential moving average
Bollinger bands
Time for action β enveloping with Bollinger bands
Linear model
Time for action β predicting price with a linear model
Trend lines
Time for action β drawing trend lines
Methods of ndarray
Time for action β clipping and compressing arrays
Factorial
Time for action β calculating the factorial
Summary
Chapter 4: Convenience Functions for
Your Convenience
Correlation
Time for action β trading correlated pairs
Polynomials
Time for action β fitting to polynomials
On-balance volume
Time for action β balancing volume
The mode
Time for action β determining the mode of stock returns
Simulation
Time for action β avoiding loops with vectorize
Smoothing
Time for action β smoothing with the hanning function
Summary
Chapter 5: Working with Matrices and ufuncs
Matrices
Time for action β creating matrices
Creating a matrix from other matrices
Time for action β creating a matrix from other matrices
Universal functions
Time for action β creating universal function
Universal function methods
Time for action β applying the ufunc methods on add
Arithmetic functions
Time for action β dividing arrays
Modulo operation
Time for action β computing the modulo
Fibonacci numbers
Time for action β computing Fibonacci numbers
Lissajous curves
Time for action β drawing Lissajous curves
Square waves
Time for action β drawing a square wave
Sawtooth and triangle waves
Time for action β drawing sawtooth and triangle waves
Bitwise and comparison functions
Time for action β twiddling bits
Summary
Chapter 6: Move Further with NumPy Modules
Linear algebra
Time for action β inverting matrices
Solving linear systems
Time for action β solving a linear system
Finding eigenvalues and eigenvectors
Time for action β determining eigenvalues and eigenvectors
Singular value decomposition
Time for action β decomposing a matrix
Pseudo inverse
Time for action β computing the pseudo inverse of a matrix
Determinants
Time for action β calculating the determinant of a matrix
Fast Fourier transform
Time for action β calculating the Fourier transform
Shifting
Time for action β shifting frequencies
Random numbers
Time for action β gambling with the binomial
Hypergeometric distribution
Time for action β simulating a game show
Continuous distributions
Time for action β drawing a normal distribution
Lognormal distribution
Time for action β drawing the lognormal distribution
Summary
Chapter 7: Peeking Into Special Routines
Sorting
Time for action β sorting lexically
Complex numbers
Time for action β sorting complex numbers
Searching
Time for action β using searchsorted
Array elements extraction
Time for action β extracting elements from an array
Financial functions
Time for action β determining future value
Present value
Time for action β getting the present value
Net present value
Time for action β calculating the net present value
Internal rate of return
Time for action β determining the internal rate of return
Periodic payments
Time for action β calculating the periodic payments
Number of payments
Time for action β determining the number of periodic payments
Interest rate
Time for action β figuring out the rate
Window functions
Time for action β plotting the Bartlett window
Blackman window
Time for action β smoothing stock prices with
the Blackman window
Hamming window
Time for action β plotting the Hamming window
Kaiser window
Time for action β plotting the Kaiser window
Special mathematical functions
Time for action β plotting the modified Bessel function
Sinc
Time for action - plotting the sinc function
Summary
Chapter 8: Assure Quality with Testing
Assert functions
Time for action β asserting almost equal
Approximately equal arrays
Time for action β asserting approximately equal
Almost equal arrays
Time for action β asserting arrays almost equal
Equal arrays
Time for action β comparing arrays
Ordering arrays
Time for action β checking the array order
Objects comparison
Time for action β comparing objects
String comparison
Time for action β comparing strings
Floating point comparisons
Time for action β comparing with
assert_array_almost_equal_nulp
Comparison of floats with more ULPs
Time for action β comparing using maxulp of 2
Summary
Chapter 9: Plotting with Matplotlib
Simple plots
Time for action β plotting a polynomial function
Plot format string
Time for action β plotting a polynomial and its derivative
Subplots
Time for action β plotting a polynomial and its derivatives
Finance
Time for action β plotting a year's worth of stock quotes
Histograms
Time for action β charting stock price distributions
Logarithmic plots
Time for action β plotting stock volume
Scatter plots
Time for action β plotting price and volume returns
with scatter plot
Fill between
Time for action β shading plot regions based on a condition
Legend and annotations
Time for action β using legend and annotations
Summary
Chapter 10: When NumPy is Not Enough: SciPy and Beyond
Matlab and Octave
Time for action β saving and loading a .mat file
Statistics
Time for action β analyzing random values
Samples comparison and SciKits
Time for action β comparing stock log returns
Signal processing
Time for action β detecting a trend in QQQ
Fourier analysis
Time for action β filtering a detrended signal
Optimization
Time for action β fitting to a sine
Numerical integration
Time for action β calculating the Gaussian integral
Interpolation
Time for action β interpolating in one dimension
Image processing
Time for action β manipulating Lena
Summary
Pop Quiz Answers
Chapter 1, NumPy Quick Start
Chapter 2, Beginning with NumPy Fundamentals
Chapter 3, Get into Terms with Commonly Used Functions
Chapter 4, Convenience Functions for Your Convenience
Chapter 5, Working with Matrices and ufuncs
Chapter 6, Move Further with NumPy Modules
Chapter 7, Peeking into Special Routines
Chapter 8, Assured Quality with Testing
Chapter 9, Plotting with Matplotlib
Chapter 10, When NumPy is not enough SciPy and Beyond
Index
π SIMILAR VOLUMES
<p>An action packed guide for the easy-to-use, high performance, free open source NumPy mathematical library using real-world examples</p> <ul> <li>The first and only book that truly explores NumPy practically</li> <li>Perform high performance calculations with clean and efficient NumPy code</li> <l
An action-packed guide for the easy-to-use, high performance, Python based free open source NumPy mathematical library using real-world examples. The first and only book that truly explores NumPy practically. Perform high performance calculations with clean and efficient NumPy code. Analyze large d
<p>An action packed guide using real world examples of the easy to use, high performance, free open source NumPy mathematical library</p> <p><b>Overview</b></p> <ul> <li>Perform high performance calculations with clean and efficient NumPy code</li> <li>Analyze large data sets with statistical functi
<p>An action packed guide using real world examples of the easy to use, high performance, free open source NumPy mathematical library</p> <p><b>Overview</b></p> <ul> <li>Perform high performance calculations with clean and efficient NumPy code</li> <li>Analyze large data sets with statistical functi