Sage Beginner's Guide


Sage Beginner's Guide
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
$25.49
save 15%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
$49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • The best way to learn  Sage which  is a open source alternative to Magma, Maple, Mathematica, and Matlab
  • Learn to use symbolic and numerical computation to simplify your work and produce publication-quality graphics
  • Numerically solve systems of equations, find roots, and analyze data from experiments or simulations
  • Save time on algebra by automatically simplifying symbolic expressions, performing calculus operations, and manipulating vectors and matrices
  • Use the Python programming language to write and debug code more quickly than traditional compiled languages like C++ or Fortran
  • Key features of Sage are explained using practical examples from engineering, science, and applied mathematics

Book Details

Language : English
Paperback : 364 pages [ 235mm x 191mm ]
Release Date : May 2011
ISBN : 1849514461
ISBN 13 : 9781849514460
Author(s) : Craig Finch
Topics and Technologies : All Books, Data, Other, Beginner's Guides, Open Source

Table of Contents

Preface
Chapter 1: What Can You Do with Sage?
Chapter 2: Installing Sage
Chapter 3: Getting Started with Sage
Chapter 4: Introducing Python and Sage
Chapter 5: Vectors, Matrices, and Linear Algebra
Chapter 6: Plotting with Sage
Chapter 7: Making Symbolic Mathematics Easy
Chapter 8: Solving Problems Numerically
Chapter 9: Learning Advanced Python Programming
Chapter 10: Where to go from here
Index
  • Chapter 1: What Can You Do with Sage?
    • Getting started
    • Using Sage as a powerful calculator
      • Symbolic mathematics
      • Linear algebra
      • Solving an ordinary differential equation
    • More advanced graphics
      • Visualising a three-dimensional surface
      • Typesetting mathematical expressions
    • A practical example: analysing experimental data
    • Time for action – fitting the standard curve
    • Time for action – plotting experimental data
    • Time for action – fitting a growth model
    • Summary
    • Chapter 2: Installing Sage
      • Before you begin
      • Installing a binary version of Sage on Windows
        • Downloading VMware Player
        • Installing VMWare Player
        • Downloading and extracting Sage
        • Launching the virtual machine
        • Start Sage
      • Installing a binary version of Sage on OS X
        • Downloading Sage
        • Installing Sage
        • Starting Sage
      • Installing a binary version of Sage on GNU/Linux
        • Downloading and decompressing Sage
        • Running Sage from your user account
        • Installing for multiple users
      • Building Sage from source
        • Prerequisites
        • Downloading and decompressing source tarball
        • Building Sage
        • Installation
      • Summary
      • Chapter 3: Getting Started with Sage
        • How to get help with Sage
        • Starting Sage from the command line
        • Using the interactive shell
        • Time for action – doing calculations on the command line
          • Getting help
          • Command history
          • Tab completion
          • Interactively tracing execution
        • Using the notebook interface
          • Starting the notebook interface
        • Time for action – doing calculations with the notebook interface
          • Getting help in the notebook interface
          • Working with cells
          • Working with code
          • Closing the notebook interface
        • Displaying results of calculations
        • Operators and variables
          • Arithmetic operators
          • Numerical types
            • Integers and rational numbers
            • Real numbers
            • Complex numbers
            • Symbolic expressions
            • Defining variables on rings
            • Combining types in expressions
          • Strings
        • Time for action – using strings
        • Callable symbolic expressions
        • Time for action – defining callable symbolic expressions
          • Automatically typesetting expressions
        • Functions
        • Time for action – calling functions
          • Built-in functions
            • Numerical approximations
            • The reset and restore functions
          • Defining your own functions
        • Time for action – defining and using your own functions
          • Functions with keyword arguments
        • Time for action – defining a function with keyword arguments
        • Objects
        • Time for action – working with objects
          • Getting help with objects
        • Summary
        • Chapter 4: Introducing Python and Sage
          • Python 2 and Python 3
          • Writing code for Sage
            • Long lines of code
            • Running scripts
          • Sequence types: lists, tuples, and strings
          • Time for action – creating lists
            • Getting and setting items in lists
          • Time for action – accessing items in a list
            • List functions and methods
            • Tuples: read-only lists
          • Time for action – returning multiple values from a function
            • Strings
          • Time for action – working with strings
            • Other sequence types
          • For loops
          • Time for action – iterating over lists
          • Time for action – computing a solution to the diffusion equation
            • List comprehensions
          • Time for action – using a list comprehension
          • While loops and text file I/O
          • Time for action – saving data in a text file
          • Time for action – reading data from a text file
            • While loops
            • Parsing strings and extracting data
            • Alternative approach to reading from a text file
          • If statements and conditional expressions
          • Storing data in a dictionary
          • Time for action – defining and accessing dictionaries
          • Lambda forms
          • Time for action – using lambda to create an anonymous function
          • Summary
          • Chapter 5: Vectors, Matrices, and Linear Algebra
            • Vectors and vector spaces
            • Time for action – working with vectors
              • Creating a vector space
              • Creating and manipulating vectors
            • Time for action – manipulating elements of vectors
              • Vector operators and methods
            • Matrices and matrix spaces
            • Time for action – solving a system of linear equations
              • Creating matrices and matrix spaces
              • Accessing and manipulating matrices
            • Time for action – accessing elements and parts of a matrix
              • Manipulating matrices
            • Time for action – manipulating matrices
              • Matrix algebra
            • Time for action – matrix algebra
              • Other matrix methods
            • Time for action – trying other matrix methods
              • Eigenvalues and eigenvectors
            • Time for action – computing eigenvalues and eigenvectors
              • Decomposing matrices
            • Time for action – computing the QR factorization
            • Time for action – computing the singular value decomposition
            • An introduction to NumPy
            • Time for action – creating NumPy arrays
              • Creating NumPy arrays
              • NumPy types
              • Indexing and selection with NumPy arrays
            • Time for action – working with NumPy arrays
              • NumPy matrices
            • Time for action – creating matrices in NumPy
              • Learning more about NumPy
            • Summary
            • Chapter 6: Plotting with Sage
              • Confusion alert: Sage plots and matplotlib
              • Plotting in two dimensions
                • Plotting symbolic expressions with Sage
              • Time for action – plotting symbolic expressions
              • Time for action – plotting a function with a pole
              • Time for action – plotting a parametric function
              • Time for action – making a polar plot
              • Time for action – plotting a vector field
                • Plotting data in Sage
              • Time for action – making a scatter plot
              • Time for action – plotting a list
                • Using graphics primitives
              • Time for action – plotting with graphics primitives
              • Using matplotlib
              • Time for action – plotting functions with matplotlib
                • Using matplotlib to "tweak" a Sage plot
              • Time for action – getting the matplotlib figure object
              • Time for action – improving polar plots
                • Plotting data with matplotlib
              • Time for action – making a bar chart
              • Time for action – making a pie chart
              • Time for action – plotting a histogram
              • Plotting in three dimensions
              • Time for action – make an interactive 3D plot
                • Higher quality output
                • Parametric 3D plotting
              • Time for action – parametric plots in 3D
                • Contour plots
              • Time for action – making some contour plots
              • Summary
              • Chapter 7: Making Symbolic Mathematics Easy
                • Using the notebook interface
                • Defining symbolic expressions
                • Time for action – defining callable symbolic expressions
                  • Relational expressions
                • Time for action – defining relational expressions
                • Time for action – relational expressions with assumptions
                • Manipulating expressions
                • Time for action – manipulating expressions
                  • Manipulating rational functions
                • Time for action – working with rational functions
                  • Substitutions
                • Time for action – substituting symbols in expressions
                  • Expanding and factoring polynomials
                • Time for action – expanding and factoring polynomials
                  • Manipulating trigonometric expressions
                • Time for action – manipulating trigonometric expressions
                  • Logarithms, rational functions, and radicals
                • Time for action – simplifying expressions
                • Solving equations and finding roots
                • Time for action – solving equations
                  • Finding roots
                • Time for action – finding roots
                • Differential and integral calculus
                • Time for action – calculating limits
                  • Derivatives
                • Time for action – calculating derivatives
                  • Integrals
                • Time for action – calculating integrals
                • Series and summations
                • Time for action – computing sums of series
                  • Taylor series
                • Time for action – finding Taylor series
                • Laplace transforms
                • Time for action – computing Laplace transforms
                • Solving ordinary differential equations
                • Time for action – solving an ordinary differential equation
                • Summary
                • Chapter 8: Solving Problems Numerically
                  • Sage and NumPy
                  • Solving equations and finding roots numerically
                  • Time for action – finding roots of a polynomial
                  • Finding minima and maxima of functions
                  • Time for action – minimizing a function of one variable
                    • Functions of more than one variable
                  • Time for action – minimizing a function of several variables
                  • Numerical approximation of derivatives
                  • Time for action – approximating derivatives with differences
                    • Computing gradients
                  • Time for action – computing gradients
                  • Numerical integration
                  • Time for action – numerical integration
                    • Numerical integration with NumPy
                  • Time for action – numerical integration with NumPy
                  • Discrete Fourier transforms
                  • Time for action – computing discrete Fourier transforms
                    • Window functions
                  • Time for action – plotting window functions
                  • Solving ordinary differential equations
                  • Time for action – solving a first-order ODE
                    • Solving a system of ODEs
                  • Time for action – solving a higher-order ODE
                    • Solving the system using the GNU Scientific Library
                  • Time for action – alternative method of solving a system of ODEs
                  • Numerical optimization
                  • Time for action – linear programming
                    • Fitting a function to a noisy data set
                  • Time for action – least squares fitting
                    • Constrained optimization
                  • Time for action – a constrained optimization problem
                  • Probability
                  • Time for action – accessing probability distribution functions
                  • Summary
                  • Chapter 9: Learning Advanced Python Programming
                    • How to write good software
                    • Object-oriented programming
                    • Time for action – defining a class that represents a tank
                      • Making our tanks move
                    • Time for action – making the tanks move
                      • Creating a module for our classes
                    • Time for action – creating your first module
                      • Expanding our simulation to other kinds of vehicles
                    • Time for action – creating a vehicle base class
                      • Creating a package for our simulation
                    • Time for action – creating a combat simulation package
                    • Potential pitfalls when working with classes and instances
                    • Time for action – using class and instance attributes
                    • Time for action – more about class and instance attributes
                      • Creating empty classes and functions
                    • Time for action – creating empty classes and functions
                    • Handling errors gracefully
                    • Time for action – raising and handling exceptions
                      • Exception types
                      • Creating your own exception types
                    • Time for action – creating custom exception types
                    • Unit testing
                    • Time for action – creating unit tests for the Tank class
                      • Strategies for unit testing
                    • Summary
                    • Chapter 10: Where to go from here
                      • Typesetting equations with LaTeX
                        • Installing LaTeX
                      • Time for action – PDF output from the notebook interface
                        • The view function in the interactive shell
                        • LaTeX mark-up in the notebook interface
                      • Time for action – working with LaTeX markup in the notebook interface
                      • Time for action – putting it all together
                      • Speeding up execution
                      • Time for action – detecting collisions between spheres
                      • Time for action – detecting collisions: command-line version
                        • Tips for measuring runtimes
                        • Optimizing our algorithm
                      • Time for action – faster collision detection
                        • Optimizing with NumPy
                      • Time for action – using NumPy
                        • More about NumPy
                        • Optimizing with Cython
                      • Time for action – optimizing collision detection with Cython
                      • Calling Sage from Python
                      • Time for action – calling Sage from a Python script
                      • Introducing Python decorators
                      • Time for action – introducing the Python decorator
                      • Making interactive graphics
                      • Time for action – making interactive controls
                        • Using interactive controls
                      • Time for action – an interactive example
                      • Summary

                      Craig Finch

                      Craig Finch is a Ph. D. candidate in the Modeling and Simulation 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 computational science and engineering and use them to solve difficult problems. In particular, he is interested in developing tools to help biologists study living systems. Craig is committed to using, developing, and promoting open-source software. He provides documentation and "how-to" examples on his blog at http://www.shocksolution.com. 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.
                      Sorry, we don't have any reviews for this title yet.

                      Code Downloads

                      Download the code and support files for this book.


                      Submit Errata

                      Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

                      Sample chapters

                      You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                      Frequently bought together

                      Sage Beginner's Guide +    Openswan: Building and Integrating Virtual Private Networks =
                      50% Off
                      the second eBook
                      Price for both: £29.05

                      Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                      What you will learn from this book

                      • Download and install Sage, and learn how to use the command-line and notebook interface
                      • Learn the basics of Python programming
                      • Solve problems in linear algebra with vectors and matrices
                      • Visualize functions and data sets with publication-quality graphics
                      • Define, re-arrange, and simplify symbolic expressions
                      • Calculate integrals, derivatives, and transforms symbolically and numerically
                      • Solve ordinary differential equations (ODEs) and systems of ODEs
                      • Fit functions to data using unconstrained and constrained numerical optimization
                      • Apply object-oriented principles to simplify your code
                      • Speed up calculations with Numpy arrays
                      • Learn to use Sage as a toolbox for writing Python programs

                      In Detail

                      Your work demands results, and you don't have time for tedious, repetitive mathematical tasks. Sage is a free, open-source software package that automates symbolic and numerical calculations with the power of the Python programming language, so you can focus on the analytical and creative aspects of your work or studies.

                      Sage Beginner's Guide shows you how to do calculations with Sage. Each concept is illustrated with a complete example that you can use as a starting point for your own work. You will learn how to use many of the functions that are built in to Sage, and how to use Python to write sophisticated programs that utilize the power of Sage.

                      This book starts by showing you how to download and install Sage, and introduces the command-line interface and the graphical notebook interface. It also includes an introduction to Python so you can start programming in Sage. Every major concept is illustrated with a practical example.

                      After learning the fundamentals of variables and functions in Sage, you will learn how to symbolically simplify expressions, solve equations, perform integrals and derivatives, and manipulate vectors and matrices. You will learn how Sage can produce numerous kinds of plots and graphics. The book will demonstrate numerical methods in Sage, and explain how to use object-oriented programming to improve your code.

                      Sage Beginner's Guide will give you the tools you need to unlock the full potential of Sage for simplifying and automating mathematical computing.

                      Effectively use Sage to eliminate tedious algebra, speed up numerical calculations, implement algorithms and data structures, and illustrate your work with publication-quality plots and graphics

                      Approach

                      This is a beginner's guide with clear step-by-step instructions, explanations, and advice. Each concept is illustrated with a complete example that you can use as a starting point for your own work.

                      Who this book is for

                      If you are an engineer, scientist, mathematician, 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.

                      Code Download and Errata
                      Packt Anytime, Anywhere
                      Register Books
                      Print Upgrades
                      eBook Downloads
                      Video Support
                      Contact Us
                      Awards Voting Nominations Previous Winners
                      Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                      Resources
                      Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software