View Single Post
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#1
SymPy is a a Computer Algebra System (CAS) written in pure Python.

See the SymPy sites :
SymPy for smartphones & tablets
SymPy.org
SymPy Wiki
SymPy documentation

Versions of SymPy :
- for Maemo 4 Diablo and Maemo 5 Fremantle : v0.7.3 (13/07/2013) is available in their repositories, this is the latest version compatible with Python 2.5;
- for MeeGo 1.2 Harmattan : v0.7.5 (22/02/2014).
- for Sailfish/Mer : v0.7.6.1 (03/09/2015).

See post #3 for SymPy release history on Maemo / MeeGo.

Screenshots of SymPy 0.7.x

Nokia N900 showing some calculus, after tapping the SymPy icon or typing "isympy" in X Terminal :



Nokia N9 running SymPy using the IPython 0.13.1 Notebook interface on Firefox v15. "init_printing()" is used to show nice outputs with LaTeX :


Nexus 4 running SymPy with IPython 2.1.0 Notebook interface on Webcat web browser :


Plotting options for SymPy 0.7.x

With SymPy there were 2 plotting options (1st and 3rd below), but since SymPy 0.7.2 there are 3 options to make plots :
1) "Plot()" using PyGlet (only on Maemo 5), see post #11 for some usage examples on Nokia N900;
2) new plotting module (from v0.7.2) using NumPy & MatPlotLib (on Maemo 5, MeeGo Harmattan and Sailfish), see post #30 for some usage examples on Nokia N9 & N900;
3) mpmath plotting functions using MatPlotLib (on Maemo 5, MeeGo Harmattan and Sailfish), see post #32 for some usage examples on Nokia N9 & N900.
Comparing the 3 options :
- 'Plot()'/PyGlet only works on Maemo 5, while plotting module and mpmath plotting work on Maemo 5, MeeGo Harmattan and Sailfish;
- 'Plot()' labels on axes and axes tick marks don't work on Maemo 5, while in plotting module they are ok;
- 'Plot()' can use cylindrical or spherical coordinate systems to make 3D parametric surfaces, while plotting 'plot3d' and mpmath plotting can't;
- 3D parametric curve of plotting module doesn't work on Maemo 5 (MatPlotLib 1.0.0 is too old);
- mpmath plotting has no 2D parametric plots and no options to specify axis names, title name, plot color, etc;
- mpmath plotting has surfaces plots with some faulty colors on Maemo 5 & MeeGo Harmattan & Sailfish;
- 3D plots with 'Plot()' are faster than with plotting module or mpmath plotting.

Nokia N9 plot made by the new plotting module of SymPy 0.7.2 :

Nokia N900 screenshot with 3D plot made by 'Plot()', it is interactive, being controlled by keyboard or stylus :


Nokia N9 showing SymPy 0.7.2 new plotting features in IPython 0.13.1 Notebook interface on Firefox v15. With "%pylab inline", MatPloLib 1.2.0 & NumPy 1.7.0 are loaded in interactive mode and the plots are embedded.


See more plot examples in post #11 about "Plot()", post #30 about new plotting module and post #32 about mpmath plotting.

Installing & using on Sailfish

To install SymPy 0.7.5 on Sailfish, install Warehouse (OpenRepos.net client) for Sailfish OS, see the Jolla Tides guide with screenshots. Then open Warehouse, search for "SymPy", enable the repository, then install it.

It is strongly suggested to also install IPython for Sailfish, so the interactive use becomes a lot easier.

On Sailfish, IPython has 2 interfaces, IPython terminal and IPython Notebook. The MeeGo Harmattan examples below apply, but there is no icon for IPython on Sailfish.

Installing & using on MeeGo Harmattan

SymPy 0.7.5 has 2 repositories options, so it can be :
- easily installed by using Warehouse / OpenRepos.net. Install Warehouse (OpenRepos.net client) for MeeGo Harmattan, then open Warehouse, search for "SymPy", enable the repository and install;
- installed by using my Harmattan repository.
SymPy 0.7.5 takes about 35 MB after install.

It is strongly suggested to also install IPython for MeeGo Harmattan, so the interactive use of MatPlotLib/NumPy becomes a lot easier
From IPython 0.13.1 Harmattan onwards, there are 3 interfaces to choose :


1) IPython 0.13 terminal interface :
1.a) Tap the IPython icon, then :
In [1]: from sympy import *
In [2]: init_printing()
The "init_printing()" is used to show pretty printing outputs.
If you want to use both PyLab (MatPlotLib + NumPy) and SymPy, always load PyLab before SymPy 0.7.3 :
In [1]: %pylab
In [2]: from sympy import *
In [3]: init_printing()
1.b) Or in Terminal, type :
$ isympy
or
$ isympy -p ascii
if (a large) output is badly not aligned.
For 1.a and 1.b, if (a large) output is badly not aligned, then use "init_printing(use_unicode=False)".

2) IPython 0.13 Qt console :
2.a) Tap the "IPy QtConsole" icon, then :
In [1]: from sympy import *
In [2]: init_printing()
The "init_printing()" is used to show nice outputs using LaTeX.
If you want to use both PyLab (MatPlotLib + NumPy) and SymPy, always load PyLab before SymPy 0.7.3 :
In [1]: %pylab inline
In [2]: from sympy import *
In [3]: init_printing()
The magic command "%pylab inline" shows plots embedded in Qt console, while "%pylab" displays plots in interactive MatPlotLib (Qt4) backend.
2.b) Or in Terminal, type :
$ ipython qtconsole
or to also load PyLab (MatPlotLib + NumPy) :
$ ipython qtconsole --pylab
or PyLab with embedded plots :
$ ipython qtconsole --pylab=inline
then :
In [1]: from sympy import *
In [2]: init_printing()

3) IPython 0.13 Notebook :
3.a) Tap the "IPy Notebook" icon, then :
In [1]: from sympy import *
In [2]: init_printing()
The "init_printing()" is used to show nice outputs using LaTeX.
If you want to use both PyLab (MatPlotLib + NumPy) and SymPy, always load PyLab before SymPy 0.7.3 :
In [1]: %pylab inline
In [2]: from sympy import *
In [3]: init_printing()
The magic command "%pylab inline" shows plots embedded in IPython notebook, while "%pylab" displays plots in interactive MatPlotLib (Qt4) backend.
3.b) Or in Terminal, type :
$ ipython notebook
or also loading PyLab (MatPlotLib + NumPy) :
$ ipython notebook --pylab
or PyLab with embedded plots :
$ ipython notebook --pylab-inline
then :
In [1]: from sympy import *
In [2]: init_printing()

The terminal commands of 1.b, 2.b and 3.b can be used in new .desktop files in "/usr/share/applications", just copy "ipy*.desktop" to fit your needs.

For making SymPy 0.7.5 plots on MeeGo Harmattan there are 2 options, both using MatPlotLib 1.2.1 (install it following the topic "MatPlotLib - 2D & 3D plots for MeeGo Harmattan") :
- new plotting module, see post #30 for more detailed instructions and examples on Nokia N9;
- mpmath plotting functions, see post #32 for more detailed instructions and examples on Nokia N9.

Install & use on Maemo 5

Click the install icon in Maemo.org Downloads or enable extras repository, search for SymPy in the application manager and install "SymPy interactive shell", it will install IPython (if not installed), SymPy (0.7.1), isympy (X-terminal script with some initialization of variables and output type) and its icon.
To install the new SymPy v0.7.3 for Maemo 5 Fremantle, enable extras-testing or extras-devel repository and search for SymPy in the application manager and install "SymPy interactive shell" 0.7.3. SymPy 0.7.3 about 20 MB after install but it is optified.
To have 3 plotting options on Maemo 5, use SymPy 0.7.2 instead, by downloading :
python-sympy_0.7.2-1maemo1_all.deb (2.3 MB)
then installing it with :
$ dpkg -i python-sympy_0.7.2-1maemo1_all.deb

To use SymPy 0.7.x on Maemo 5 :
1) the "SymPy" icon or the terminal command "isympy" opens IPython terminal (if installed, or else just X Terminal and Python) and setup SymPy interactive mode;
2) If you want to use both PyLab (MatPlotLib 1.0.0 + NumPy 1.4.0) and SymPy.
2.a) Tap the IPython icon, then always load PyLab before SymPy :
In [1]: %pylab
In [2]: from sympy import *
In [3]: init_printing()
The "init_printing()" is used to show pretty printing outputs.
2.b) Or in Terminal, type :
$ ipython --pylab
then :
In [1]: from sympy import *
In [2]: init_printing()

There are 3 options for making SymPy 0.7.2 plots on Maemo 5 Fremantle, while only the 1st option and 3rd options work with SymPy 0.7.1/0.7.3 :
1) "Plot()" for 2D/3D interactive plots, using PyGlet". See post #11 of this topic for more detailed instructions to use 'Plot()' on Maemo 5.
See also the topic PyGlet for Maemo 5 or the PyGlet for Maemo 5 web page for more details. To install PyGlet on Maemo 5, just open "X terminal" :
$ sudo gainroot
# apt-get update
# apt-get install python-pyglet
Beware that PyGlet takes 6.4 MB (it is optified) after install plus its mesa dependencies use 5.2 MB in root partition.
2) new plotting module, using MatPlotLib. See post #30 for more detailed instructions and examples on Nokia N900. To install it on Maemo 5 takes about 39 MB (which 3 MB not-optified), use the X Terminal with Extras-Devel repository enabled and type :
$ sudo gainroot
# apt-get update
# apt-get install python-matplotlib
Then, as user, create the folder "/home/user/.matplotlib" and the file "/home/user/.matplotlib/matplotlibrc" with the text :
datapath : /usr/share/matplotlib/mpl-data
backend : Qt4Agg
3) mpmath plotting functions, using MatPlotLib. See post #32 for more detailed instructions and examples on Nokia N900. Follow the instructions above to install MatPlotLib.

To Nokia N900 users, please help promote SymPy, SymPy Interactive Shell and SymPy Documentation to extras repository by voting in :
SymPy 0.7.3-3maemo3
SymPy interactive shell 0.7.3-1fremantle1
SymPy documentation and examples

Install & use on Maemo 4

Click the install icon in Maemo.org Downloads (the description still shows v0.7.1 but it will install v0.7.3) or enable extras repository, search for SymPy in the application manager and install "SymPy Interactive Shell", it will install IPython (if not installed, using 6 MB after install), SymPy 0.7.3, isympy (X-terminal script with some initialization of variables and output type) and its icon.
SymPy v0.7.3 (20 MB) and its dependency python2.5-dev (other 15 MB) takes about 35 MB after install.
The SymPy icon or the terminal command "isympy" launches the IPython interactive shell and loads SymPy with some initialization (of variables and output type).


See post #36 and post #38 for detailed SymPy benchmarks.

SymPy is also used by "Integral", "Derivative" and "Limit" on Maemo 4 & 5. With SymPy 0.7.2 onwards, due to the new beta function, beta can't be used anymore as symbol/variable.
__________________
Python, C/C++, Qt and CAS developer. For Maemo/MeeGo/Sailfish :
Integral, Derivative, Limit - calculating mathematical integrals, derivatives and limits. SymPy - Computer Algebra System.
MatPlotLib - 2D & 3D plots in Python. IPython - Python interactive shell.
-- My blog about mobile & scientific computing ---
Sailfish : Sony Xperia X, Gemini, Jolla, Jolla C, Jolla Tablet, Nexus 4. Nokia N9, N900, N810.

Last edited by rcolistete; 2016-08-16 at 14:10. Reason: SymPy 0.7.6.1 for Sailfish
 

The Following 28 Users Say Thank You to rcolistete For This Useful Post: