SageMath is a computer algebra system which uses python, throughout these labs sage cells will be used for certain problems. This lab introduces you to the basics of using SageMath via Sage Cells.

Introduction

If you ever want to use a sage cell when one is not provided, or would like to experiment with Sage Cells, you can follow this link.

Functions

To define a function you use the notation in the following sage cell:

What output did you get from evaluating the sage cell?
None
Evaluate the function at by typing f(3) in the sage cell, what did you get?
Define in the following cell evaluate at
In sage, you type pi for and remember to use the carrot for powers and * for multiplication!
What did you get?
If you don’t use function notation, or want to define a function of multiple variables you must define your variables before using them, as in the following Sage Cell. The following sage cell defines the equation , and then solves it for .
From the sage cell above, what can you say about ‘‘=’’ vs ‘‘==’’?
‘‘=’’ is used for assignment and ‘‘==’’ is used to signify equality ‘‘=’’ is used to signify equality and ‘‘==’’ is used for assignment
The solve command is also shown above, it’s fairly intuitive to use, the thing you want to solve is the first parameter and what you’re solving for is the second parameter.
Using the solve command, find the roots for
You should be solving for
Copy paste what you got in your sage cell here:

Getting Help

If you ever get stuck trying to use a command, there is built in documentation (as well as Google). Type the command followed directly by ‘‘?’’ to get extensive documentation on how to use it with examples. Try this for the solve command in the following cell.