
v1.23 - 02/17/08 SAGE For Newbies 1/150 SAGE For Newbies by Ted Kosan Copyright © 2007 by Ted Kosan This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ v1.23 - 02/17/08 SAGE For Newbies 2/150 Table of Contents 1 Preface....................................................................................................8 1.1 Dedication.....................................................................................................8 1.1 Acknowledgments.........................................................................................8 1.2 Support Group..............................................................................................8 2 Introduction............................................................................................9 2.1 What Is A Mathematics Computing Environment?......................................9 2.2 What Is SAGE?............................................................................................10 2.3 Accessing SAGE As A Web Service............................................................12 2.3.1 Accessing SAGE As A Web Service Using Scenario 1.........................13 2.4 Entering Source Code Into A SAGE Cell....................................................16 3 SAGE Programming Fundamentals......................................................20 3.1 Objects, Values, And Expressions...............................................................20 3.2 Operators....................................................................................................21 3.3 Operator Precedence..................................................................................22 3.4 Changing The Order Of Operations In An Expression...............................23 3.5 Variables.....................................................................................................23 3.6 Statements..................................................................................................25 3.6.1 The print Statement................................................................................25 3.7 Strings........................................................................................................27 3.8 Comments...................................................................................................27 3.9 Conditional Operators................................................................................28 3.10 Making Decisions With The if Statement.................................................30 3.11 The and, or, And not Boolean Operators..................................................32 3.12 Looping With The while Statement..........................................................34 3.13 Long-Running Loops, Infinite Loops, And Interrupting Execution..........36 3.14 Inserting And Deleting Worksheet Cells..................................................37 3.15 Introduction To More Advanced Object Types.........................................37 3.15.1 Rational Numbers..............................................................................37 3.15.2 Real Numbers....................................................................................38 3.15.3 Objects That Hold Sequences Of Other Objects: Lists And Tuples...39 3.15.3.1 Tuple Packing And Unpacking........................................................40 3.16 Using while Loops With Lists And Tuples................................................41 3.17 The in Operator........................................................................................42 3.18 Looping With The for Statement..............................................................42 3.19 Functions..................................................................................................43 3.20 Functions Are Defined Using the def Statement......................................43 3.21 A Subset Of Functions Included In SAGE................................................45 3.22 Obtaining Information On SAGE Functions.............................................52 3.23 Information Is Also Available On User-Entered Functions.......................53 v1.23 - 02/17/08 SAGE For Newbies 3/150 3.24 Examples Which Use Functions Included With SAGE..............................54 3.25 Using srange() And zip() With The for Statement....................................55 3.26 List Comprehensions................................................................................56 4 Object Oriented Programming..............................................................58 4.1 Object Oriented Mind Re-wiring................................................................58 4.2 Attributes And Behaviors............................................................................58 4.3 Classes (Blueprints That Are Used To Create Objects)..............................59 4.4 Object Oriented Programs Create And Destroy Objects As Needed..........59 4.5 Object Oriented Program Example............................................................60 4.5.1 Hellos Object Oriented Program Example (No Comments)................60 4.5.2 Hellos Object Oriented Program Example (With Comments).................61 4.6 SAGE Classes And Objects.........................................................................65 4.7 Obtaining Information On SAGE Objects...................................................65 4.8 The List Object's Methods..........................................................................67 4.9 Extending Classes With Inheritence...........................................................68 4.10 The object Class, The dir() Function, And Built-in Methods....................70 4.11 The Inheritance Hierarchy Of The sage.rings.integer.Integer Class.......71 4.12 The "Is A" Relationship.............................................................................73 4.13 Confused?.................................................................................................73 5 Miscellaneous Topics............................................................................74 5.1 Referencing The Result Of The Previous Operation...................................74 5.2 Exceptions..................................................................................................74 5.3 Obtaining Numeric Results........................................................................75 5.4 Style Guide For Expressions.......................................................................76 5.5 Built-in Constants.......................................................................................76 5.6 Roots...........................................................................................................78 5.7 Symbolic Variables.....................................................................................78 5.8 Symbolic Expressions.................................................................................79 5.9 Expanding And Factoring.......................................................................80 5.10 Miscellaneous Symbolic Expression Examples.....................................81 5.11 Passing Values To Symbolic Expressions..............................................81 5.12 Symbolic Equations and The solve() Function.........................................82 5.13 Symbolic Mathematical Functions...........................................................83 5.14 Finding Roots Graphically And Numerically With The find_root() Method ...........................................................................................................................84 5.15 Displaying Mathematical Objects In Traditional Form............................85 5.15.1 LaTeX Is Used To Display Objects In Traditional Mathematics Form .......................................................................................................................86 5.16 Sets...........................................................................................................86 6 2D Plotting............................................................................................88 6.1 The plot() And show() Functions................................................................88 6.1.1 Combining Plots And Changing The Plotting Color.............................90 v1.23 - 02/17/08 SAGE For Newbies 4/150 6.1.2 Combining Graphics With A Graphics Object......................................91 6.2 Advanced Plotting With matplotlib.............................................................92 6.2.1 Plotting Data From Lists With Grid Lines And Axes Labels................93 6.2.2 Plotting With A Logarithmic Y Axis.....................................................93 6.2.3 Two Plots With Labels Inside Of The Plot............................................94 7 SAGE Usage Styles................................................................................96 7.1 The Speed Usage Style...............................................................................96 7.2 The OpenOffice Presentation Usage Style.................................................96 8 High School Math Problems (most of the problems are still in development)............................................................................................97 8.1 Pre-Algebra.................................................................................................97 8.1.1 Equations.............................................................................................97
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages150 Page
-
File Size-