www.it-ebooks.info
Sage
Beginner's Guide
Unlock the full potenal of Sage for simplifying and
automang mathemacal compung
Craig Finch
BIRMINGHAM - MUMBAI
www.it-ebooks.info
Sage
Beginner's Guide
Copyright © 2011 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmied in any form or by any means, without the prior wrien permission of the
publisher, except in the case of brief quotaons embedded in crical arcles or reviews.
Every eort has been made in the preparaon of this book to ensure the accuracy of the
informaon presented. However, the informaon contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.
Packt Publishing has endeavored to provide trademark informaon about all of the
companies and products menoned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this informaon.
First published: May 2011
Producon Reference: 1250411
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-849514-46-0
www.packtpub.com
Cover Image by Ed Maclean ()
www.it-ebooks.info
Credits
Author
Craig Finch
Reviewers
Dr. David Kirkby
Minh Nguyen
Acquision Editor
Usha Iyer
Development Editor
Hyacintha D'Souza
Technical Editor
Ajay Shanker
Indexers
Tejal Daruwale
Rekha Nair
Project Coordinator
Joel Goveya
Proofreaders
Aaron Nash
Mario Cecere
Graphics
Nilesh Mohite
Producon Coordinator
Adline Swetha Jesuthas
Cover Work
Adline Swetha Jesuthas
www.it-ebooks.info
About the Author
Craig Finch is a Ph. D. Candidate in the Modeling and Simulaon program at the University
of Central Florida (UCF). He earned a Bachelor of Science degree from the University
of Illinois at Urbana-Champaign and a Master of Science degree from UCF, both in
electrical engineering. Craig worked as a design engineer for TriQuint Semiconductor, and
currently works as a research assistant in the Hybrid Systems Lab at the UCF NanoScience
Technology Center. Craig's professional goal is to develop tools for computaonal science
and engineering and use them to solve dicult problems. In parcular, he is interested
in developing tools to help biologists study living systems. Craig is commied to using,
developing, and promong open-source soware. He provides documentaon and "how-to"
examples on his blog at .
I would like to thank my advisers, Dr. J. Hickman and Dr. Tom Clarke, for
giving me the opportunity to pursue my doctorate. I would also like to
thank my parents for buying the Apple IIGS computer that started it all.
www.it-ebooks.info
About the Reviewers
Dr. David Kirkby is a chartered engineer living in Essex, England. David has a B.Sc. in
Electrical and Electronic Engineering, an M.Sc. in Microwaves and OptoElectronics, and a
Ph.D. in Medical Physics. Despite David's Ph.D. being in Medical Physics, it was primarily an
engineering project, measuring the opcal properes of human ssue, with a mixture of
Monte Carlo modeling, radio frequency design, and laser opcs. David was awarded his Ph.D.
in 1999 from University College London.
Although not a mathemacian, Dr. Kirkby has made extensive use of mathemacal soware.
Most of his experience has been with MathemacaTM from Wolfram Research, although he
has used both MATLAB
TM
and Simulink
TM
too.
David is the author of a number of open-source projects, including soware for modeling
transmission lines using nite dierence (
design of
Yagi-Uda antennas ( which can use a genec algorithm
for opmizaon, as well as soware for data collecon and analysis from electronic test
equipment. David once wrote a web-based interface to MathemacaTM (http://witm.
sourceforge.net/
) which allows MathemacaTM to be used from a personal computer,
PDA or smartphone.
Soon aer the Sage project was started by Professor William Stein, Dr. Kirkby joined the
development of Sage. He primarily worked on the successful port of Sage to the Solaris and
OpenSolaris operang systems and encourages other developers to write portable code,
conforming to POSIX standard, avoiding GNUisms.
Professionally, David's skill sets include computer modeling, radio frequency design,
analogue circuit design, electromagnec compability and opcs—both free space
and integrated. David has also been a Solaris system administrator for the University of
Washington where the Sage project is based.
When not working on wring soware, David enjoys playing chess, gardening, and
spending me with his wife Lin and dog Smudge.
Readers wishing to contact Dr. Kirkby can do so via his website
irkby.
co.uk/
where details of his consulng services may be found.
www.it-ebooks.info
Minh Nguyen has been a contributor to the Sage project since December 2007. Over the
years, he has worked on various aspects of Sage ranging from the standard documentaon and
modules such as cryptography, number theory, and graph theory to the Sage build system. He
regularly maintains the Sage website and works on book projects that aim to provide in-depth
documentaon on using Sage to study cryptography and mathemacs. More of his ranngs
can be found at .
www.it-ebooks.info
www.PacktPub.com
Support les, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support les and downloads related to
your book.
Did you know that Packt oers eBook versions of every book published, with PDF and ePub
les available? You can upgrade to the eBook version at
www.PacktPub.com and as a print
book customer, you are entled to a discount on the eBook copy. Get in touch with us at
for more details.
At
www.PacktPub.com, you can also read a collecon of free technical arcles, sign up for a
range of free newsleers and receive exclusive discounts and oers on Packt books and eBooks.
Do you need instant soluons to your IT quesons? PacktLib is Packt's online digital book
library. Here, you can access, read and search across Packt's enre library of books.
Why Subscribe?
Fully searchable across every book published by Packt
Copy & paste, print and bookmark content
On demand and accessible via web browser
Free Access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view nine enrely free books. Simply use your login credenals for
immediate access.
www.it-ebooks.info
www.it-ebooks.info
Table of Contents
Preface 1
Chapter 1: What Can You Do with Sage? 9
Geng started 9
Using Sage as a powerful calculator 12
Symbolic mathemacs 14
Linear algebra 17
Solving an ordinary dierenal equaon 18
More advanced graphics 19
Visualising a three-dimensional surface 20
Typeseng mathemacal expressions 21
A praccal example: analysing experimental data 22
Time for acon – ng the standard curve 22
Time for acon – plong experimental data 24
Time for acon – ng a growth model 25
Summary 26
Chapter 2: Installing Sage 29
Before you begin 29
Installing a binary version of Sage on Windows 30
Downloading VMware Player 30
Installing VMWare Player 30
Downloading and extracng Sage 30
Launching the virtual machine 31
Start Sage 32
Installing a binary version of Sage on OS X 33
Downloading Sage 34
Installing Sage 34
Starng Sage 34
www.it-ebooks.info
Table of Contents
[ ii ]
Installing a binary version of Sage on GNU/Linux 35
Downloading and decompressing Sage 35
Running Sage from your user account 36
Installing for mulple users 37
Building Sage from source 38
Prerequisites 38
Downloading and decompressing source tarball 39
Building Sage 39
Installaon 39
Summary 39
Chapter 3: Geng Started with Sage 41
How to get help with Sage 41
Starng Sage from the command line 42
Using the interacve shell 43
Time for acon – doing calculaons on the command line 43
Geng help 45
Command history 46
Tab compleon 47
Interacvely tracing execuon 48
Using the notebook interface 48
Starng the notebook interface 49
Time for acon – doing calculaons with the notebook interface 52
Geng help in the notebook interface 54
Working with cells 54
Working with code 55
Closing the notebook interface 55
Displaying results of calculaons 56
Operators and variables 56
Arithmec operators 57
Numerical types 58
Integers and raonal numbers 58
Real numbers 59
Complex numbers 60
Symbolic expressions 60
Dening variables on rings 61
Combining types in expressions 62
Strings 62
Time for acon – using strings 62
Callable symbolic expressions 63
Time for acon – dening callable symbolic expressions 64
Automacally typeseng expressions 65
www.it-ebooks.info
Table of Contents
[ iii ]
Funcons 66
Time for acon – calling funcons 66
Built-in funcons 68
Numerical approximaons 68
The reset and restore funcons 69
Dening your own funcons 70
Time for acon – dening and using your own funcons 70
Funcons with keyword arguments 72
Time for acon – dening a funcon with keyword arguments 72
Objects 73
Time for acon – working with objects 74
Geng help with objects 75
Summary 77
Chapter 4: Introducing Python and Sage 79
Python 2 and Python 3 79
Wring code for Sage 80
Long lines of code 81
Running scripts 81
Sequence types: lists, tuples, and strings 82
Time for acon – creang lists 82
Geng and seng items in lists 85
Time for acon – accessing items in a list 85
List funcons and methods 87
Tuples: read-only lists 87
Time for acon – returning mulple values from a funcon 87
Strings 89
Time for acon – working with strings 90
Other sequence types 92
For loops 92
Time for acon – iterang over lists 92
Time for acon – compung a soluon to the diusion equaon 94
List comprehensions 99
Time for acon – using a list comprehension 99
While loops and text le I/O 101
Time for acon – saving data in a text le 101
Time for acon – reading data from a text le 103
While loops 105
Parsing strings and extracng data 105
Alternave approach to reading from a text le 106
If statements and condional expressions 107
Storing data in a diconary 108
www.it-ebooks.info
Table of Contents
[ iv ]
Time for acon – dening and accessing diconaries 108
Lambda forms 110
Time for acon – using lambda to create an anonymous funcon 110
Summary 111
Chapter 5: Vectors, Matrices, and Linear Algebra 113
Vectors and vector spaces 113
Time for acon – working with vectors 114
Creang a vector space 115
Creang and manipulang vectors 116
Time for acon – manipulang elements of vectors 116
Vector operators and methods 117
Matrices and matrix spaces 118
Time for acon – solving a system of linear equaons 118
Creang matrices and matrix spaces 120
Accessing and manipulang matrices 120
Time for acon – accessing elements and parts of a matrix 120
Manipulang matrices 122
Time for acon – manipulang matrices 122
Matrix algebra 124
Time for acon – matrix algebra 124
Other matrix methods 125
Time for acon – trying other matrix methods 126
Eigenvalues and eigenvectors 127
Time for acon – compung eigenvalues and eigenvectors 127
Decomposing matrices 129
Time for acon – compung the QR factorizaon 129
Time for acon – compung the singular value decomposion 131
An introducon to NumPy 133
Time for acon – creang NumPy arrays 133
Creang NumPy arrays 134
NumPy types 135
Indexing and selecon with NumPy arrays 136
Time for acon – working with NumPy arrays 136
NumPy matrices 137
Time for acon – creang matrices in NumPy 137
Learning more about NumPy 139
Summary 139
Chapter 6: Plong with Sage 141
Confusion alert: Sage plots and matplotlib 141
Plong in two dimensions 141
www.it-ebooks.info
Table of Contents
[ v ]
Plong symbolic expressions with Sage 142
Time for acon – plong symbolic expressions 142
Time for acon – plong a funcon with a pole 144
Time for acon – plong a parametric funcon 146
Time for acon – making a polar plot 147
Time for acon – plong a vector eld 149
Plong data in Sage 150
Time for acon – making a scaer plot 150
Time for acon – plong a list 151
Using graphics primives 153
Time for acon – plong with graphics primives 153
Using matplotlib 155
Time for acon – plong funcons with matplotlib 155
Using matplotlib to "tweak" a Sage plot 157
Time for acon – geng the matplotlib gure object 158
Time for acon – improving polar plots 159
Plong data with matplotlib 161
Time for acon – making a bar chart 161
Time for acon – making a pie chart 163
Time for acon – plong a histogram 164
Plong in three dimensions 165
Time for acon – make an interacve 3D plot 166
Higher quality output 167
Parametric 3D plong 168
Time for acon – parametric plots in 3D 168
Contour plots 169
Time for acon – making some contour plots 169
Summary 171
Chapter 7: Making Symbolic Mathemacs Easy 173
Using the notebook interface 174
Dening symbolic expressions 174
Time for acon – dening callable symbolic expressions 174
Relaonal expressions 176
Time for acon – dening relaonal expressions 176
Time for acon – relaonal expressions with assumpons 178
Manipulang expressions 179
Time for acon – manipulang expressions 179
Manipulang raonal funcons 180
Time for acon – working with raonal funcons 181
Substuons 182
www.it-ebooks.info
Table of Contents
[ vi ]
Time for acon – substung symbols in expressions 182
Expanding and factoring polynomials 184
Time for acon – expanding and factoring polynomials 184
Manipulang trigonometric expressions 186
Time for acon – manipulang trigonometric expressions 186
Logarithms, raonal funcons, and radicals 187
Time for acon – simplifying expressions 187
Solving equaons and nding roots 190
Time for acon – solving equaons 190
Finding roots 191
Time for acon – nding roots 191
Dierenal and integral calculus 193
Time for acon – calculang limits 193
Derivaves 195
Time for acon – calculang derivaves 195
Integrals 198
Time for acon – calculang integrals 198
Series and summaons 199
Time for acon – compung sums of series 199
Taylor series 200
Time for acon – nding Taylor series 200
Laplace transforms 202
Time for acon – compung Laplace transforms 202
Solving ordinary dierenal equaons 204
Time for acon – solving an ordinary dierenal equaon 204
Summary 206
Chapter 8: Solving Problems Numerically 207
Sage and NumPy 208
Solving equaons and nding roots numerically 208
Time for acon – nding roots of a polynomial 208
Finding minima and maxima of funcons 210
Time for acon – minimizing a funcon of one variable 210
Funcons of more than one variable 211
Time for acon – minimizing a funcon of several variables 211
Numerical approximaon of derivaves 213
Time for acon – approximang derivaves with dierences 213
Compung gradients 215
Time for acon – compung gradients 215
Numerical integraon 217
Time for acon – numerical integraon 217
www.it-ebooks.info
Table of Contents
[ vii ]
Numerical integraon with NumPy 219
Time for acon – numerical integraon with NumPy 219
Discrete Fourier transforms 220
Time for acon – compung discrete Fourier transforms 220
Window funcons 223
Time for acon – plong window funcons 223
Solving ordinary dierenal equaons 224
Time for acon – solving a rst-order ODE 224
Solving a system of ODEs 226
Time for acon – solving a higher-order ODE 226
Solving the system using the GNU Scienc Library 229
Time for acon – alternave method of solving a system of ODEs 229
Numerical opmizaon 231
Time for acon – linear programming 231
Fing a funcon to a noisy data set 233
Time for acon – least squares ng 233
Constrained opmizaon 235
Time for acon – a constrained opmizaon problem 235
Probability 236
Time for acon – accessing probability distribuon funcons 236
Summary 238
Chapter 9: Learning Advanced Python Programming 241
How to write good soware 242
Object-oriented programming 243
Time for acon – dening a class that represents a tank 244
Making our tanks move 249
Time for acon – making the tanks move 249
Creang a module for our classes 253
Time for acon – creang your rst module 253
Expanding our simulaon to other kinds of vehicles 258
Time for acon – creang a vehicle base class 258
Creang a package for our simulaon 263
Time for acon – creang a combat simulaon package 263
Potenal pialls when working with classes and instances 268
Time for acon – using class and instance aributes 269
Time for acon – more about class and instance aributes 270
Creang empty classes and funcons 272
Time for acon – creang empty classes and funcons 272
Handling errors gracefully 273
Time for acon – raising and handling excepons 274
www.it-ebooks.info
Table of Contents
[ viii ]
Excepon types 278
Creang your own excepon types 279
Time for acon – creang custom excepon types 279
Unit tesng 284
Time for acon – creang unit tests for the Tank class 284
Strategies for unit tesng 288
Summary 289
Chapter 10: Where to go from here 291
Typeseng equaons with LaTeX 291
Installing LaTeX 292
Time for acon – PDF output from the notebook interface 293
The view funcon in the interacve shell 297
LaTeX mark-up in the notebook interface 297
Time for acon – working with LaTeX markup in the notebook interface 297
Time for acon – pung it all together 300
Speeding up execuon 304
Time for acon – detecng collisions between spheres 304
Time for acon – detecng collisions: command-line version 307
Tips for measuring runmes 309
Opmizing our algorithm 309
Time for acon – faster collision detecon 309
Opmizing with NumPy 311
Time for acon – using NumPy 311
More about NumPy 314
Opmizing with Cython 314
Time for acon – opmizing collision detecon with Cython 314
Calling Sage from Python 316
Time for acon – calling Sage from a Python script 316
Introducing Python decorators 319
Time for acon – introducing the Python decorator 319
Making interacve graphics 322
Time for acon – making interacve controls 322
Using interacve controls 328
Time for acon – an interacve example 328
Summary 330
Index 333
www.it-ebooks.info
Preface
Results maer, whether you are a mathemacian, scienst, or engineer. The me that you
spend doing tedious mathemacal calculaons could be spent in more producve ways. Sage
is an open-source mathemacal soware system that helps you perform many mathemacal
tasks. There is no reason to compute integrals or perform algebraic manipulaons by hand
when soware can perform these tasks more quickly and accurately (unless you are a
student who is learning these procedures for the rst me). Students can also benet from
mathemacal soware. The ability to plot funcons and manipulate symbolic expressions
easily can improve your understanding of mathemacal concepts. Likewise, it is largely
unnecessary to write your own rounes for numerical mathemacs in low-level languages
such as FORTRAN or C++. Mathemacal soware systems like Sage have highly opmized
funcons that implement common numerical operaons like integraon, solving ordinary
dierenal equaons, and solving systems of equaons.
Sage is a collecon of nearly 100 mathemacal soware packages, which are listed at
When possible, exisng tools
are integrated into Sage, rather than duplicang their funconality. The enre collecon of
tools can be downloaded and installed as a binary distribuon or compiled from source code.
The Python language provides a unied interface to all of the packages. Python is a high-
level, interpreted, object-oriented programming language that is already well established
in the research community. Users can interact with Sage through an interacve command-
line interface or a graphical notebook interface. Sage can also be used as a Python library or
embedded in LaTeX documents. Sage is "ocially" available for recent versions of OS X, Linux,
Solaris, and Open Solaris. It runs on Windows with the help of a virtual machine and it can
be used on other plaorms, with varying degrees of support. A current list of all the available
plaorms can be found at />www.it-ebooks.info
Preface
[ 2 ]
The mission statement of the Sage project is:
Creating a viable, free, open source alternative to Magma, Maple,
Mathematica, and Matlab.
If you are familiar with any of these commercial mathemacal soware systems, then you
already have a good idea what Sage does. Sage oers several advantages over its commercial
competors. Sage is free, open-source soware, released under the GNU Public License
version 2 or higher (GPLv2+). There is no cost to download and install Sage, whether you
want to put it on your personal computer, install it in a university teaching lab, or deploy
it on every workstaon in a company. This advantage is especially important in developing
countries. The GPL license also means that Sage is free, as in "freedom." There are no
restricons on how or where you use the soware, the license can never be revoked, and
there is no annual maintenance fee. Another advantage is that you have access to every
line of source code, so you can see how every calculaon is performed, and track exactly
what changes are made from one version to the next. Unlike commercial soware, the bug
list for Sage is public, and it can be accessed at Users are
encouraged to parcipate in the development of Sage by reporng and xing bugs, and
contribung new capabilies. With bugs and source code open for public review, you can
have a high degree of condence that Sage will produce correct results.
This book is wrien for people who are new to Sage, and perhaps new to mathemacal
soware altogether. For this reason, the examples in the book emphasize undergraduate-level
mathemacs such as calculus, linear algebra, and ordinary dierenal equaons. However,
Sage is capable of performing advanced mathemacs, and it has been cited in over 80
mathemacal publicaons. A full list can be found at
/>publications.html
. To benet from this book, you should have some fundamental
knowledge of computer programming, but the Python language will be introduced as needed
throughout the book. The next chapter will take you through some examples that showcase a
small subset of Sage's capabilies.
What this book covers
Chapter 1, What can You do with Sage? covers how Sage can be used for: making simple
numerical calculaons; performing symbolic calculaons, solving systems of equaons and
ordinary dierenal equaons; making plots in two and three dimensions; and analyzing
experimental data and ng models.
Chapter 2, Installing Sage covers how to install a binary version of Sage on Windows and
install a binary version of Sage on OS X; install a binary version of Sage on GNU/Linux;
compile Sage from source.
www.it-ebooks.info
Preface
[ 3 ]
Chapter 3, Geng Started with Sage covers using the interacve shell; using the notebook
interface; learning more about operators and variables; dening and using callable symbolic
expressions; calling funcons and making simple plots; dening your own funcons; and
working with objects in Sage.
Chapter 4, Introducing Python and Sage covers how to: use lists and tuples to store
sequenal data; iterate with loops; construct logical tests with "if" statements; read and
write data les; and store heterogeneous data in diconaries.
Chapter 5, Vectors, Matrices, and Linear Algebra covers how to create and manipulate vector
and matrix objects; how Sage can take the tedious work out of linear algebra; learning about
matrix methods for compung eigenvalues, inverses, and decomposions; and geng
started with NumPy arrays and matrices for numerical calculaons.
Chapter 6, Plong with Sage covers how to plot funcons of one variable; making various
types of specialized 2D plots such as polar plots and scaer plots; using matplotlib to
precisely format 2D plots and charts; and making interacve 3D plots of funcons of two
variables.
Chapter 7, Making Symbolic Mathemacs Easy covers how to create symbolic funcons
and expressions, and learn to manipulate them; solve equaons and systems of equaons
exactly, and nd symbolic roots; automate calculus operaons like limits, derivaves, and
integrals; create innite series and summaons to approximate funcons; perform Laplace
transforms; and nd exact soluons to ordinary dierenal equaons.
Chapter 8, Solving Problems Numerically covers how to nd the roots of an equaon;
compute integrals and derivaves numerically; nd minima and maxima of funcons;
compute discrete Fourier transforms, and apply window funcons; numerically solve an
ordinary dierenal equaon (ODE), and systems of ODEs; use opmizaon techniques
to t curves and nd minima; and explore the probability tools in Sage.
Chapter 9, Learning Advanced Python Programming covers how to dene your own classes;
use inheritance to expand the usefulness of your classes; organize your class denions in
module les; bundle module les into packages; handle errors gracefully with excepons;
dene your own excepons for custom error handling; and use unit tests to make sure your
package is working correctly.
Chapter 10, Where to go from here covers how to export equaons as PNG and PDF
les; export vector graphics and typeset mathemacal expressions for inclusion in LaTeX
documents; use LaTeX to document Sage worksheets; speed up collision detecon using
NumPy vector operaons; create a Python script that uses Sage funconality; and create
interacve graphical examples in the notebook interface.
www.it-ebooks.info
Preface
[ 4 ]
What you need for this book
Required:
Sage
If using Windows, VMWare Player or VirtualBox is also required.
Recommended, but not strictly necessary: LaTeX
Oponal, for building Sage from source on Linux: GCC, g++, make, m4, perl,
ranlib, readline, and tar
Oponal, for building Sage from source on OS X: XCode
A web browser is required to use the notebook interface
Who this book is for
If you are an engineer, scienst, mathemacian, or student, this book is for you. To get the
most from Sage by using the Python programming language, we'll give you the basics of the
language to get you started. For this, it will be helpful if you have some experience with basic
programming concepts.
Conventions
In this book, you will nd several headings appearing frequently.
To give clear instrucons of how to complete a procedure or task, we use:
Time for action – heading
1. Acon 1
2. Acon 2
3. Acon 3
Instrucons oen need some extra explanaon so that they make sense, so they are
followed with:
What just happened?
This heading explains the working of tasks or instrucons that you have just completed.
www.it-ebooks.info
Preface
[ 5 ]
You will also nd some other learning aids in the book, including:
Pop quiz – heading
These are short mulple choice quesons intended to help you test your own understanding.
Have a go hero – heading
These set praccal challenges and give you ideas for experimenng with what you have
learned.
You will also nd a number of styles of text that disnguish between dierent kinds of
informaon. Here are some examples of these styles, and an explanaon of their meaning.
Code words in text are shown as follows: "We can use the
help funcon to learn more
about it."
A block of code is set as follows:
print('This is a string')
print(1.0)
print(sqrt)
Any command-line input or output is wrien as follows:
sage: R = 250e3
sage: C = 4e-6
sage: tau = R * C
sage: tau
New terms and important words are shown in bold. Words that you see on the screen, in
menus or dialog boxes for example, appear in the text like this: "clicking the Next buon
moves you to the next screen".
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
www.it-ebooks.info
Preface
[ 6 ]
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or may have disliked. Reader feedback is important for us to
develop tles that you really get the most out of.
To send us general feedback, simply send an e-mail to
, and
menon the book tle via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in
the SUGGEST A TITLE form on
www.packtpub.com or e-mail
If there is a topic that you have experse in and you are interested in either wring or
contribung to a book, see our author guide on
www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help
you to get the most from your purchase.
Downloading the example code
You can download the example code les for all Packt books you have purchased from your
account at . If you purchased this book elsewhere, you can
visit and register to have the les e-mailed directly
to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do
happen. If you nd a mistake in one of our books—maybe a mistake in the text or the code—
we would be grateful if you would report this to us. By doing so, you can save other readers
from frustraon and help us improve subsequent versions of this book. If you nd any
errata, please report them by vising selecng
your book, clicking on the errata submission form link, and entering the details of your
errata. Once your errata are veried, your submission will be accepted and the errata will
be uploaded on our website, or added to any list of exisng errata, under the Errata secon
of that tle. Any exisng errata can be viewed by selecng your tle from
http://www.
packtpub.com/support
.
www.it-ebooks.info
Preface
[ 7 ]
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt,
we take the protecon of our copyright and licenses very seriously. If you come across any
illegal copies of our works, in any form, on the Internet, please provide us with the locaon
address or website name immediately so that we can pursue a remedy.
Please contact us at
with a link to the suspected pirated material.
We appreciate your help in protecng our authors, and our ability to bring you valuable
content.
Questions
You can contact us at if you are having a problem with any
aspect of the book, and we will do our best to address it.
www.it-ebooks.info
www.it-ebooks.info