Last Updated 04/18/2017

Sage Essentials
Section 2: Algebraic Calculations

The .sub command

Example 4

You can also use the .sub command to substitute a value into an equation. This is the sort of thing you might want to do to test whether a particular value "satisfies" the equation. In the next few lines we substitute different values into the equation x35x2 +7x12. Are any of these values a solution to the equation?

Note we use " = " as the assignment command and "==" as the relational notation "equals" within in the equation.

As you can see, since -9 is not equal to 0, 3 is not a solution to the equation, and 0 = 0 indicates that 4 is in fact a solution.


← Previous Example Next Example →