This session will provide a hands-on introduction to the basic capabilities of Sage.
This will cover the bulk of the Maple and Mathematica capabilities that are used in Calculus and other undergraduate mathematics courses.
|
|
|
|
|
Try a random 200 by 200 matrix with big integer entries. Then calculate its determinant. It could be a big number.
|
|
|
|
|
Sage does Calculus:
|
|
|
|
|
|
![]() |
|
![]() |
|
Let's start with a result by Archimedes, namely that
$\pi < \frac{22}{7}$.
Archimedes used a very geometric approach involving inscribed and circumscribed polygons.
But today we might simply ask Sage, or any other modern Computer Algebra System (CAS), to evaluate the integral
$\int_0^1 \frac{(1-x)^4 x^4}{1+x^2} \,dx$
|
Since the integrand is positive on the interval (0,1), the inequality immediately follows. However, this may not be completely satisfactory until we look at the antiderivative.
$\int \frac{(1-x)^4 x^4}{1+x^2} \,dx$
|
Of course this approach not only depends on modern Computer Algebra Systems. It also depends on the mathematical edifice of Trigonometry and Calculus that led to the wonderful relation
$\int \frac{1}{1+x^2} \,dx = arctan(x)$
We can push further by taking the geometric series
$\frac{1}{1-x} = 1 + x + x^2 + x^3 + \cdots$
which only converges for $|x| < 1$, and replace $x$ by $-x^2$ to get the alternating series
$\frac{1}{1+x^2} = 1 - x^2 + x^4 - x^6 + \cdots$
Then, following James Gregory's lead (1668), integrate term by term to get the series
$\arctan(x) = x - \frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + \cdots$
Finally, we can conclude, since we have an alternating series with decreasing terms, that
$\frac{\pi}{4} = \arctan(1) = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + \cdots = \sum\limits_{k=0}^\infty {\frac{(-1)^k}{2k+1}}$
Gregory's series can be used to calculate $\pi$, but it has notoriously slow convergence, but studying it with the aid of today's computers has led to some surprising connections.
|
As noted above, Gregory's series for $\pi$, is over 300 years old and has notoriously slow convergence.
$\pi = 4 \sum\limits_{k=0}^\infty {\frac{{( - 1)^k }}{{2k + 1}}}$
Nonetheless, let's take an experimental approach and compute some partial sums with a little more accuracy than pencil and paper or even 12-digit calculators.
|
With 10 terms the second digit is incorrect, but third and fourth happen to be correct -- probably just a curious coincidence.
With 100 terms the second digit is now correct, but the third digit is wrong. On the other hand the next 4 digits, 1592, happen to be OK.
With 1000 terms the third digit is now correct, but the fourth digit is wrong. On the other hand the next 6 digits, 592653, happen to be OK.
With 10,000 terms the fourth digit is now correct, but the fifth digit is wrong. On the other hand the next 6 digits, 926535, happen to be OK.
With a half a million terms we get the fifth and sixth digits correct, but the seventh digit is wrong. On the other hand, the next 10 digits, 6535897932, are correct. The next 2 digits are wrong but the next 10 digits, 4626422832, are correct. After that, we have one wrong digit followed by another 10 correct digits, 9502884198. Then 3 wrong digits, and, wrapping up, the 7 last digits are correct.
Something beyond coincidence is certainly going on here!
Although it took the sophisticated expertise of three mathematicians to explain the phenomenon; the experimental observation that got the ball rolling was by Joseph Roy North of Colorado Springs - a person of commendable curiosity.
Jonathan Borwein, Peter Borwein, and Karl Dilcher, "Pi, Euler Numbers, and Asymptotic Expansions", American Math Monthly, 1989.
|
|
|
The OEIC confirms that these first 6 corrections are indeed the first 6 Euler numbers with alternating signs.
The OEIC also gives us a number of connections and references -- including the paper that first examined this phenomenon.
The bottom line is that we have experimentally established the fact that it is highly likely that the error in the Gregory series has an asymptotic expansion whose coefficients involve the Euler numbers.
In fact, armed with this insight, which they obtained in a very similar fashion, Dilcher and the brothers Borwein showed that the first 6 terms of the asymptotic expansion for even $n$ are:
$\frac{E_0}{2n}$, $\frac{E_2}{(2n)^3}$, $\frac{E_4}{(2n)^5}$, $\frac{E_6}{(2n)^7}$, $\frac{E_8}{(2n)^9}$, and $\frac{E_{10}}{(2n)^{11}}$
where $E_0 = 1$, $E_2 = -1$, $E_4 = 5$, $E_6 = -61$, $E_8 = 1385$, and $E_{10} = -50521$.
|
(x, y, u, v) (x, y, u, v) |
|
|
|
|
Sage can draw 3d plots:
|
|
|
|
Sage can plot Yoda:
|
|
t t |
|
|
|
|
|
|
|
|
|
c + beta/alpha c*e^alpha + beta/alpha c*e + beta/alpha c*e^(2*alpha) + beta/alpha c + beta/alpha c*e^alpha + beta/alpha c*e + beta/alpha c*e^(2*alpha) + beta/alpha |
t |--> 20*e^(1/2*t) + 80 t |--> 20*e^(1/2*t) + 80 |
|
(k1*sin(1/4*sqrt(31)*t) + k2*cos(1/4*sqrt(31)*t))*e^(-1/4*t) (k1*sin(1/4*sqrt(31)*t) + k2*cos(1/4*sqrt(31)*t))*e^(-1/4*t) |
t |--> 1/2*(sin(1/4*sqrt(31)*t) + 2*cos(1/4*sqrt(31)*t))*e^(-1/4*t) t |--> 1/2*(sin(1/4*sqrt(31)*t) + 2*cos(1/4*sqrt(31)*t))*e^(-1/4*t) |
|
-(log(-P + r(t)) - log(r(t)))/(P*alpha) == c + t -(log(-P + r(t)) - log(r(t)))/(P*alpha) == c + t |
-(P - r(t))/r(t) == K*e^(-P*alpha*t) -(P - r(t))/r(t) == K*e^(-P*alpha*t) |
[r(t) == -P*e^(P*alpha*t)/(K - e^(P*alpha*t))] [r(t) == -P*e^(P*alpha*t)/(K - e^(P*alpha*t))] |
|
|
|
|
Sage can do graph theory:
|
|
Sage contains many unique and deep algorithms:
|