Jupyter Notebook

SICMUtils, 3


The goal of this post to setup Jupyter Notebook.


1. Read and follow the exact steps of my post titled “SICMUtils“.


2. To install the Jupyter Notebook software in Ubuntu, use this command:

sudo apt-get install sagemath-jupyter 

3. Try to open the SageMath program.

4. It will open a Jupyter notebook page.

5. Click the “New” button at the top right corner and then select “SageMath“.


6. Type

1 + 1

onto the input line.

7. Hit the keys shift-enter to get the output



8. Input

Integrate(x^3, x)

9. Hit shift-enter:

NameError: name 'Integrate' is not defined


10. Input

from sage.symbolic.integration.integral import *

indefinite_integral(x^3, x)

11. Hit shift-enter:



12. Input

%display latex

13. Hit shift-enter.


14. Input

indefinite_integral(x^3, x)

15. Hit shift-enter:

\displaystyle{\frac{1}{4} \, x^{4}}

— Me@2022-07-30 12:18:50 PM



2022.08.01 Monday (c) All rights reserved by ACHK

Problem 14.5d1.2 | SageMath

The generating function is an infinite product:

\displaystyle{ \begin{aligned} \alpha' M_L^2: \end{aligned}}

\displaystyle{\begin{aligned} &f_{L, NS+}(x) \\ &= a_{NS+} (r) x^r \\ &= \frac{1}{x} \prod_{r=1}^\infty \frac{(1 + x^{r-\frac{1}{2}})^{32}}{(1 - x^r)^8} \\ \end{aligned}}

To evaluate the infinite product, you can use SageMath with the following commands:


(1/x)*prod(((1+x^(n-1/2))^(32)/(1-x^n)^8) for n in (1..oo))

a = (1/x)*prod(((1+x^(n-1/2))^(32)/(1-x^n)^8) for n in (1..200))

F = a.taylor(x,0,6)

g = "+".join(map(latex, sorted([f for f in F.operands()], key=lambda exp:exp.degree(x))))


\displaystyle{ \begin{aligned}  &f_{L, NS+}(x) \\  \end{aligned}}

\displaystyle{  \approx \frac{1}{x}+\frac{32}{\sqrt{x}}+504+5248 \, \sqrt{x}+40996 \, x+258624 \, x^{\frac{3}{2}}+1384320 \, x^{2}+6512384 \, x^{\frac{5}{2}} + ...}

— Me@2019-01-11 11:52:33 AM



2019.01.11 Friday (c) All rights reserved by ACHK

Sage (mathematics software)

Design Philosophy of Sage


William Stein realized several important facts when designing Sage.

* To create viable alternatives to Magma, Maple, Mathematica, and MATLAB, would take hundreds, or thousands of man-years if one started from the beginning.
* There was a large collection of open-source mathematics software already written, but which was written in different languages (C, C++, Fortran and Python being the most common).

So rather than start from the beginning, Sage which is written in Python and Cython integrates all their specialized mathematics software into a common interface. A user needs to know only Python.

Where no open-source option exists for a particular class of problem, then this would be written in Sage. But Sage does not reinvent the wheel. The same design philosophy is used in commercial mathematics program such as Mathematica, but Sage can use a much wider range of open source software solutions than nonfree software, since some open source licensing imposes restrictions on commercial use of code.

— Wikipedia on Sage (mathematics software)



2010.03.14 Sunday ACHK