售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Scientific Computing with Python 3
Scientific Computing with Python 3
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Why subscribe?
Acknowledgement
Preface
What this book covers
What you need for this book
Who this book is for
Python vs Other Languages
Other Python literature
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started
Installation and configuration instructions
Installation
Anaconda
Configuration
Python Shell
Executing scripts
Getting Help
Jupyter – Python notebook
Program and program flow
Comments
Line joining
Basic types
Numbers
Strings
Variables
Lists
Operations on lists
Boolean expressions
Repeating statements with loops
Repeating a task
Break and else
Conditional statements
Encapsulating code with functions
Scripts and modules
Simple modules - collecting functions
Using modules and namespaces
Interpreter
Summary
2. Variables and Basic Types
Variables
Numeric types
Integers
Plain integers
Floating point numbers
Floating point representation
Infinite and not a number
Underflow - Machine Epsilon
Other float types in NumPy
Complex numbers
Complex Numbers in Mathematics
The j notation
Real and imaginary parts
Booleans
Boolean operators
Boolean casting
Automatic Boolean casting
Return values of and and or
Boolean and integer
Strings
Operations on strings and string methods
String formatting
Summary
Exercises
3. Container Types
Lists
Slicing
Strides
Altering lists
Belonging to a list
List methods
In–place operations
Merging lists – zip
List comprehension
Arrays
Tuples
Dictionaries
Creating and altering dictionaries
Looping over dictionaries
Sets
Container conversions
Type checking
Summary
Exercises
4. Linear Algebra – Arrays
Overview of the array type
Vectors and matrices
Indexing and slices
Linear algebra operations
Solving a linear system
Mathematical preliminaries
Arrays as functions
Operations are elementwise
Shape and number of dimensions
The dot operations
The array type
Array properties
Creating arrays from lists
Accessing array entries
Basic array slicing
Altering an array using slices
Functions to construct arrays
Accessing and changing the shape
The shape function
Number of dimensions
Reshape
Transpose
Stacking
Stacking vectors
Functions acting on arrays
Universal functions
Built-in universal functions
Create universal functions
Array functions
Linear algebra methods in SciPy
Solving several linear equation systems with LU
Solving a least square problem with SVD
More methods
Summary
Exercises
5. Advanced Array Concepts
Array views and copies
Array views
Slices as views
Transpose and reshape as views
Array copy
Comparing arrays
Boolean arrays
Checking for equality
Boolean operations on arrays
Array indexing
Indexing with Boolean arrays
Using where
Performance and Vectorization
Vectorization
Broadcasting
Mathematical view
Constant functions
Functions of several variables
General mechanism
Conventions
Broadcasting arrays
The broadcasting problem
Shape mismatch
Typical examples
Rescale rows
Rescale columns
Functions of two variables
Sparse matrices
Sparse matrix formats
Compressed sparse row
Compressed Sparse Column
Row-based linked list format
Altering and slicing matrices in LIL format
Generating sparse matrices
Sparse matrix methods
Summary
6. Plotting
Basic plotting
Formatting
Meshgrid and contours
Images and contours
Matplotlib objects
The axes object
Modifying line properties
Annotations
Filling areas between curves
Ticks and ticklabels
Making 3D plots
Making movies from plots
Summary
Exercises
7. Functions
Basics
Parameters and arguments
Passing arguments - by position and by keyword
Changing arguments
Access to variables defined outside the local namespace
Default arguments
Beware of mutable default arguments
Variable number of arguments
Return values
Recursive functions
Function documentation
Functions are objects
Partial application
Using Closures
Anonymous functions - the lambda keyword
The lambda construction is always replaceable
Functions as decorators
Summary
Exercises
8. Classes
Introduction to classes
Class syntax
The __init__ method
Attributes and methods
Special methods
Reverse operations
Attributes that depend on each other
The property function
Bound and unbound methods
Class attributes
Class methods
Subclassing and inheritance
Encapsulation
Classes as decorators
Summary
Exercises
9. Iterating
The for statement
Controlling the flow inside the loop
Iterators
Generators
Iterators are disposable
Iterator tools
Generators of recursive sequences
Arithmetic geometric mean
Convergence acceleration
List filling patterns
List filling with the append method
List from iterators
Storing generated values
When iterators behave as lists
Generator expression
Zipping iterators
Iterator objects
Infinite iterations
The while loop
Recursion
Summary
Exercises
10. Error Handling
What are exceptions?
Basic principles
Raising exceptions
Catching exceptions
User-defined exceptions
Context managers - the with statement
Finding Errors: Debugging
Bugs
The stack
The Python debugger
Overview - debug commands
Debugging in IPython
Summary
11. Namespaces, Scopes, and Modules
Namespace
Scope of a variable
Modules
Introduction
Modules in IPython
The IPython magic command
The variable __name__
Some useful modules
Summary
12. Input and Output
File handling
Interacting with files
Files are iterable
File modes
NumPy methods
savetxt
loadtxt
Pickling
Shelves
Reading and writing Matlab data files
Reading and writing images
Summary
13. Testing
Manual testing
Automatic testing
Testing the bisection algorithm
Using unittest package
Test setUp and tearDown methods
Parameterizing tests
Assertion tools
Float comparisons
Unit and functional tests
Debugging
Test discovery
Measuring execution time
Timing with a magic function
Timing with the Python module timeit
Timing with a context manager
Summary
Exercises
14. Comprehensive Examples
Polynomials
Theoretical background
Tasks
The polynomial class
Newton polynomial
Spectral clustering
Solving initial value problems
Summary
Exercises
15. Symbolic Computations - SymPy
What are symbolic computations?
Elaborating an example in SymPy
Basic elements of SymPy
Symbols - the basis of all formulas
Numbers
Functions
Undefined functions
Elementary Functions
Lambda - functions
Symbolic Linear Algebra
Symbolic matrices
Examples for Linear Algebra Methods in SymPy
Substitutions
Evaluating symbolic expressions
Example: A study on the convergence order of Newton's Method
Converting a symbolic expression into a numeric function
A study on the parameter dependency of polynomial coefficients
Summary
References
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜