|
Create a viable free open source alternative to Magma, Maple, Mathematica, and Matlab.
|
|
|
|
|
|
With a little thought you can answer the following questions without a calculator or computer or even pencil and paper.
How many trailing zeros should $100!$ have? From the previous calculation it must be 24, but why?
How many trailing zeros should $200!$ have? Hint, it is not 48.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It can do similar calculations and plots with polynomials and rational functions.
|
|
|
![]() |
|
|
![]() |
|
|
|
|
|
|
|
First, Sage makes extensive use of classes
|
|
|
|
This example illustrated the fact that Python variables by default are "programming variables" and must be initialized.
To create a symbolic variable we must declare the variable with the var command.
The variable x is a special case for convenience.
|
|
This example illustrated the for loop in Python.
First, the for statement walking through a list of objects and it ends with the colon.
Second, the block inside the loop is indented. There are no begin ... end constructs in Python.
Good programming style strongly suggests that you indent subordinate blocks of code.
Python insists that you indent and rewards you with shorter programs.
|
This example underscored the fact that the single "=" is assignment and the double "==" is equality.
It also showed that multiple statements can be on the same line when separated by ";"
|
In this example, the solution is returned in a list. Lists are the principal data structure workhorse.
|
In this example we used the dictionary, which is the most sophisticated built-in data structure in Python.
|
A simple nonlinear example consisting of a straight line intersecting a circle.
|
|
We can easily create a nice illustration of this problem and its solution.
|
The following example by Jason Grout uses Sage to solve a system of three non-linear equations with 4 unknowns, where one of the unknowns, $u$, is treated as a parameter and set to 1.
|
|
|
|
A slightly more complicated formula involving trigonometric functions with parameters.
|
Differentiating this expression illustrates that Sage knows the product rule, the chain rule, and the derivatives of sin and cos.
|
Integrating this expression illustrates that Sage knows integration by parts.
|
Sage can define and manipulate functions.
|
![]() |
![]() |
|
|
|