Let's say that you need to make some quick calculations to design a simple electrical circuit. We will use the example of a series RC circuit, which consists of a resistor and a capacitor connected in series:
The voltage across the capacitor can be described by a linear, first-order differential equation. Eventually we will learn to solve differential equations with Sage, but for now we will just use the solution, which is well known:
Define variables.
First, we'll define some variables to work with. Type in the following text at the command prompt, and press Enter after every line:
sage: R = 250e3 sage: C = 4e-6 sage: tau = R * C sage: tau 1.00000000000000
Sage doesn't give any output from variable definitions. You can type the variable name and press Enter to see what it contains.
Perform a calculation.
The voltage across the capacitor is a function of time. Let's set an initial voltage v0 and compute the voltage after one second:
sage...