Functions, Control, and Getting Help

- Getting Help. Sage has extensive built-in documentation, accessible by typing the name of a function or a constant (for example), followed by a question mark.
- Defining Functions. To define a new function in Sage, use the
`def`command and a colon after the list of variable names. - Built-In Functions. Sage has many built-in functions such as
`sin(x)`. - Piecewise Defined Functions. Piecewise functions in a single variable can be defined in Sage.
- Counting and Iteration. In Sage, you count by iterating over a range of integers.
- Iteration, Tables, and String Formatting. One easy way to print a table with a
`for`loop is to use string formatting. - Linking Several Sage Cells. It is possible to link two or more Sage cells so that a cell will remember any computations does in previous cells.
- Formatting Sage Output with show. You can use the
`show`command or method to present Sage output in a nice mathematical format. - Getting LaTeX Output from Sage. How to have Sage print an answer in LaTeX.