2022;
477 pp;
Softcover

MSC: Primary 15; 97; 34; 68; 65;
Secondary 90; 11; 28; 40

**Print ISBN: 978-1-4704-6155-3
Product Code: MBK/143**

List Price: $59.00

AMS Member Price: $47.20

MAA Member Price: $53.10

**Electronic ISBN: 978-1-4704-7114-9
Product Code: MBK/143.E**

List Price: $59.00

AMS Member Price: $47.20

MAA Member Price: $53.10

#### You may also like

#### Supplemental Materials

# Sage for Undergraduates: Second Edition, Compatible with Python 3

Share this page
*Gregory V. Bard*

As the open-source and free alternative to expensive software like
Maple™, Mathematica®, and MATLAB®, Sage offers anyone
with a web browser the ability to use cutting-edge mathematical
software and share the results with others, often with stunning
graphics. This book is a gentle introduction to Sage for undergraduate
students during Calculus II, Multivariate Calculus, Differential
Equations, Linear Algebra, Math Modeling, or Operations Research.

This book assumes no background in programming, but the reader who
finishes the book will have learned about 60 percent of a first semester
computer science course, including much of the Python programming
language. The audience is not only math majors, but also physics,
engineering, environmental science, finance, chemistry, economics,
data science, and computer science majors. Many of the book's examples
are drawn from those fields. Filled with “challenges” for the students
to test their progress, the book is also ideal for self-study.

What's New in the Second Edition:

In 2019, Sage transitioned from Python 2 to Python 3, which changed
the syntax in several significant ways, including for the print
command. All the examples in this book have been rewritten to be
compatible with Python 3. Moreover, every code block longer than four
lines has been placed in an archive on the book's website
http://www.sage-for-undergraduates.org that is maintained by
the author, so that the students won't have to retype the code! Other
additions include…

- The number of “challenges” for the students to test their own progress in learning Sage has roughly doubled, which will be a great boon for self-study.
- There's approximately 150 pages of new content, including:
- New projects on Leontief Input-Output Analysis and on Environmental Science
- New sections on Complex Numbers and Complex Analysis, on SageTex, and on solving problems via Monte-Carlo Simulations.

- The first three sections of Chapter 1 have been completely rewritten to give absolute beginners a smoother transition into Sage.

#### Readership

Undergraduate students, graduate students, and research mathematicians interested in using Sage in (teaching) math modeling, engineering, physics, multivariate calculus, differential equations, matrix algebra, and linear algebra.

#### Reviews & Endorsements

Professor Bard has provided a valuable service by carefully explaining everything an undergraduate student of mathematics, or a teacher of these topics, needs to get started with Sage quickly and easily. It will also be useful for any student or teacher of another STEM discipline. There is an excellent mix of the most frequently used commands, along with warnings about common pitfalls or caveats. I highly recommend it for anyone new to Sage, or who desires an overview of the system's impressive capabilities.

-- Robert A. Beezer, University of Puget Sound

This book is a sort of “Missing Manual” that explains how Sage can be used in a range of standard mathematics courses, instead of targeting specialists like much existing Sage documentation. The depth of content is very impressive, and describes—in a single coherent narrative—how to successfully use Sage for a wide swath of undergraduate applied topics.

-- William Stein, University of Washington, Seattle

#### Table of Contents

# Table of Contents

## Sage for Undergraduates: Second Edition, Compatible with Python 3

- Cover Cover11
- Title page iii4
- Contents vii8
- The Preface: How to Use This Book xi12
- Chapter 1. Welcome to Sage! 118
- 1.1. Using Sage as a Calculator 118
- 1.2. Using Sage with Common Functions 724
- 1.3. Using Sage for Trigonometry 1633
- 1.4. Using Sage to Graph 2-Dimensionally 2138
- 1.5. Matrices and Sage, Part 1 3350
- 1.6. Making Your Own Functions in Sage 4562
- 1.7. Using Sage to Manipulate Polynomials 5067
- 1.8. Using Sage to Solve Problems Symbolically 5370
- 1.9. Using Sage as a Numerical Solver 6279
- 1.10. Getting Help When You Need It 7087
- 1.11. Using Sage to Take Derivatives 7491
- 1.12. Using Sage to Calculate Integrals 7693
- 1.13. Sharing the Results of Your Work 93110
- 1.14. A Technicality about Functions 99116

- Chapter 2. Fun Projects Using Sage 103120
- 2.1. Microeconomics: Computing a Selling Price 104121
- 2.2. Biology: Clogged Arteries and Poiseuille’s Law 109126
- 2.3. Industrial Optimization: Shipping Taconite 112129
- 2.4. Chemistry: Balancing Reactions with Matrices 115132
- 2.5. Physics: Ballistic Projectiles 120137
- 2.6. Cryptology: Pollard’s 𝑝-1 Attack on RSA 127144
- 2.7. Mini-Project on Electric Field Vector Plots 135152
- 2.8. Environmental Science: Lead and Motherboards 136153
- 2.9. Macroeconomics: Leontief Input-Output Analysis 141158

- Chapter 3. Advanced Plotting Techniques 155172
- 3.1. Annotating Graphs for Clarity 155172
- 3.2. Graphs of Some Hyperactive Functions 163180
- 3.3. Polar Plotting 164181
- 3.4. Graphing an Implicit Function 170187
- 3.5. Contour Plots and Level Sets 173190
- 3.6. Parametric 2D Plotting 180197
- 3.7. Vector Field Plots 182199
- 3.8. Log-Log Plots 189206
- 3.9. The Removed Section 191208

- Chapter 4. Advanced Features of Sage 193210
- 4.1. Using Sage with Multivariable Functions and Equations 193210
- 4.2. Working with Large Formulas in Sage 195212
- 4.3. Derivatives and Gradients in Multivariate Calculus 200217
- 4.4. Matrices and Sage, Part 2 201218
- 4.5. Vector Operations 211228
- 4.6. Working with the Integers and Number Theory 213230
- 4.7. Some More Commands in Sage 224241
- 4.8. Calculating Limits Expressly 227244
- 4.9. Scatter Plots in Sage 228245
- 4.10. Making Your Own Regressions in Sage 232249
- 4.11. Computing in Octal? Binary? And Hexadecimal? 234251
- 4.12. Can Sage Do Sudoku? 236253
- 4.13. Measuring the Speed of Sage 236253
- 4.14. Huge Numbers and Sage 237254
- 4.15. Using Sage and \LaTeX, Part 1 240257
- 4.16. Matrices and Sage, Part 3 241258
- 4.17. Computing Taylor or MacLaurin Polynomials 251268
- 4.18. Minimizations and Lagrange Multipliers 254271
- 4.19. Infinite Sums and Series 260277
- 4.20. Continued Fractions in Sage 264281
- 4.21. Systems of Inequalities and Linear Programming 266283
- 4.22. Differential Equations 273290
- 4.23. Laplace Transforms 285302
- 4.24. Vector Calculus in Sage 288305
- 4.25. Using Sage and \LaTeX, Part 2 300317
- 4.26. Complex Numbers and Sage 305322

- Chapter 5. Programming in Sage and Python 317334
- 5.1. Repetition without Boredom: The for Loop 319336
- 5.2. Writing Subroutines 331348
- 5.3. Loops and Newton’s Method 339356
- 5.4. An Introduction to Control Flow 354371
- 5.5. More Concepts in Flow Control 363380
- 5.6. while Loops versus for Loops 370387
- 5.7. How Arrays and Lists Work 381398
- 5.8. Simulations: The Monte Carlo Method 387404
- 5.9. Some Intermediate-Level Techniques 402419
- 5.10. Where Do You Go from Here? 411428

- Chapter 6. Building Interactive Webpages with Sage 417434
- Appendix A. What to Do When Frustrated! 433450
- Appendix B. Transitioning to SageMathCloud 443460
- Appendix C. Translating Python 2 to Python 3 447464
- Acknowledgments for the Second Edition 455472
- Acknowledgments for the First Edition 461478
- Bibliography 467484
- Index 471488
- Back Cover Back Cover1495