Last Updated 04/18/2017

Sage Essentials
Section 1: Numerical Calculations

Numerical Approximations

Example 2

Assigning a name to the result of a calculation makes it easier to use that result in a subsequent calculation. To assign a name we use the format of name = value. On the next line we have assigned the letter k to the original output in the last example. Then we apply the numerical approximation command n() to k.

Sage is case sensitive. So for example Sage considers k and K to be different variables.

By the way, you can also use words as variable names.

Try this! Assign 5 to the variable x and -2 to the variable y. Then compute xy.


← Previous Example Next Example →