Book Image

Sage Beginner's Guide

By : Craig Finch
1 (1)
Book Image

Sage Beginner's Guide

1 (1)
By: Craig Finch

Overview of this book

Table of Contents (17 chapters)
Sage Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – doing calculations with the notebook interface


Now, we will use the Notebook interface to repeat the calculations that we did with the interactive shell. We will add some text to document what we've done.

  1. Define variables.

    The empty white box in the middle of the worksheet is an input cell. Click in the input cell and type in the following text:

    R = 250e3	# ohms
    C = 4e-6	# Farads
    tau = R * C
    tau

    To evaluate the cell, press Shift-Enter or click the evaluate link, which is found just below the bottom-left corner of the input cell. As soon as the code executes, an empty input cell appears on the screen below the previous cell. The screen will look like this:

  2. Perform a calculation.

    You can also insert an empty input cell by moving the cursor into the blank space above or below an existing cell. When a thin, solid bar appears in the blank space, click to insert a new input cell. Enter the following code in the next input cell:

    v0 = 20.0    # Volts
    t = 1.0      # seconds
    v0 * exp(-t...