Software for Algebra and Geometry Experimentation
while Mathematica, Matlab, and Maple are very expensive.
SAGE = Python + Local Web Interface + Tons of Work
A GOOD CALCULATOR - but a lot better than others
We can do simple arithmetic with SAGE:
Use: * for multiplication, + for addition, - for subtraction, / divide, ^ or ** for exponentiation
Place mouse on the cell below. Then press "evaluate" that appears below this cell. Or press Shift-Enter. (Note: don't put the equals (=) sign! )
|
|
|
|
|
|
|
|
|
|
At the very least, it can do what any calculator can do. SAGE will try to perform everything according to the standard ORDER of operations.
FRACTIONS
It can handle fractions symbolically (manipulate algebraically as if all are symbols) and numerically. More on the difference later. We will use the pound sign "#" to place a comment within the cell without affecting what you're calculating. SAGE-python knows this.
|
|
|
|
Now we can further process that last result using the following method:
|
|
|
|
|
|
|
|
Handling Exponents using the caret ^ symbol or double asterisk **.
|
|
|
|
|
|
|
|
SQUARE ROOTS
Use the square root function sqrt( )
|
|
|
|
Notice that if it can't get the exact value of the square root of 5, it will handle it just symbolically. And it would seem like it didn't do anything. You see it simply wants to try to maintain an exact value. To force it to perform and provide at least an estimate of the square root, just add a decimal point so that SAGE knows your input is a decimal and you want it to give an answer in decimal form. Then in the next cell we introduce the number "n" operator to control the number of digits of our final answer/estimate.
|
|
Then in the next cell we introduce the number "n" operator to control the number of digits of our final answer/estimate. This is even better.
|
|
|
|
|
|
|
|
Using the UNDERSCORE "_ " and the SHOW( ) functions or commands:
We use the underscore "_" symbol to mean "use the last result" OR more precisely, the result of the last cell that was evaluated. This is a really great time-saver as it aids in better manipulation w/o retyping longer and complicated expressions if they happen to be one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PI and the SEMICOLON
SAGE can be used do display \pi's approximate value up to a certain number of digits. Note: we use a semicolon to separate the instructions or commands we want SAGE to do for us. This means we can do multiple instructions within one cell.
|
|
|
|
|
|
BASIC ALGEBRA: VARIABLES, EXPRESSIONS, AND EQUATIONS
In SAGE, x is considered a variable. To use other letters as variables, one must "declare" them using the var command:
|
|
ASSIGNing (using one equal sign =) a whole expression to another letter makes it easier to manipulate expressions. We demonstrate this below:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DIVIDING POLYNOMIALS
This is a bit tricky: How does one tell SAGE how to divide two polynomials? Answer: It depends on (1) SAGE's default format and (2) on what format you want it to be displayed. SAGE's default format is try to write things in simplest form w/c means as a factored form. So sometimes, one would think it's not doing anything.
|
|
|
|
|
|
|
|
Let's define the following polynomial: P(x) =2 \, {\left(x - 2\right)}^{3} {\left(x^{2} - 4 \, x + 3\right)}
|
|
|
|
|
|
|
|
|
|
Won't explain this one in detail. You will find the details in the manual. The important thing is how you can divide polynomails
and format the result as a sum of terms in descending order including a possible remainder (normally a rational expression).
|
|
|
|
|
|
|
|
|
|
This is the format we want. The remainder is 432. Hence, we can write the overall result also as:
2 \, x^{4} - 10 \, x^{3} + 28 \,x^{2} - 8 \, x + 96 + \frac{432}{{\left(x - 5\right)}}
|
|
Another way to do this would be to use the "cryptic" code. W(P(x)) says consider P(x) as a polynomial. Then take the quotient plus the remainder using (x-5). Oh well....
|
|
|
|
|
|
|
|
|
|
|
|
NEGATIVE EXPONENTS are automatically converted to (simplified to) positive exponents
|
|
|
|
GREATEST COMMON FACTOR(DENOMINATOR)
|
|
|
|
|
|
LEAST COMMON MULTIPLE (LCM)
|
|
|
|
Here's a "trick" you can use to get the LCM of two variable expressions like x^{2} and 2x^{5}. First, make them the denominators of unit fractions (1 over your expression). Pretend you will add them all. Then use the factor command to force SAGE to combine them into one rational expression. Then you can also use "show" to get a better view of the result. Finally, you can see that the LCD (or our LCM) here is 2x^{5}.
|
|
|
|
FACTORING
|
|
|
|
|
|
|
|
SOLVING EQUATIONS
We use the double equal signs "= =" to write an equation. The single equal sign "=" as in some examples above mean just assigning an expression to, say, a variable so we can reuse that expression without retyping it.
|
|
We use solve(equation, variable to be solved). Note: use parenthesis ( ) not square brackets [ ].
|
|
Or we can directly put the equation inside the solve( put equation here, put variable to be solved here) like this:
|
|
|
|
|
|
|
|
PLOTTING
|
|
|
|
|
We can plot several graphs at a time for easy comparison: x^{2} + 2 \, x - 1, x^{2} + 2 \, x, x^{2} + 2 \, x + 1, x^{2} + 2 \, x + 2
|
|
|
|
An Example of a 3D plot you can play around with!
|
|
ANIMATION where time is involved!
Visit: http://sage.math.washington.edu/home/mhansen/sage-epydoc/sage.plot.animate.Animation-class.html
![]()
|
THE END
|
|