Notices


Reply
Thread Tools
Posts: 198 | Thanked: 130 times | Joined on Sep 2012 @ Pakistan
#31
rcolistete. Much Appreciated.

keep up the brilliant work!
 

The Following User Says Thank You to khan.orak For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#32
The 2nd option to plot using SymPy 0.7.1/0.7.3, and the 3rd option to plot inside SymPy 0.7.2 is the use of mpmath plotting functions, which depend on MatPlotLib, so only available on Maemo 5 and MeeGo Harmattan.

Here are some examples of using the mpmath plotting functions, repeating some plots from post #11 (where another option to make plots in SymPy, "Plot()"/PyGlet, was used).

Observations about mpmath plots and MatPlotLib :
- mpmath plotting has no 2D parametric plots and no options to specify axis names, title name, plot color, etc;
- "import sympy.mpmath" is used instead of "from sympy.mpmath import *" to avoid conflict with the new "plot()" function (from plotting module);
- on Maemo 5, there is the warning message :
"/usr/lib/python2.5/site-packages/matplotlib/font_manager.py:1242: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to Bitstream Vera Sans"
and some symbols ('-' in axis numbers, etc) are not shown.
- on Maemo 5 and MeeGo Harmattan, mpmath plot functions without the option "file=<filename>" opens the interactive backend of MatPlotLib on your Nokia N900/N9/N950;
- on Maemo 5, the surface plots have some faulty colors, due MatPlotLib v1.00 being old;
- on MeeGo Harmattan, use MatPlotLib 1.2.0 so all the features cited here will work.

The 1st time is measured (with "%time") after loading "isympy", the 2nd time is for repeating plottings. Time is measured on Nokia N9 @ 1 GHz (with MatPlotLib 1.2.0 & NumPy 1.7.0) and Nokia N900 @ 600 Mhz (with MatPlotLib 1.0.0 & NumPy 1.4.0), both using SymPy 0.7.2.

2D Plot of a function of 1 variable, y = f(x), a dumped harmonic oscillator :
In [1]: import sympy.mpmath
In [2]: mpmath.plot(lambda x: 2.5*exp(-1.0*x/2)*cos(mpmath.pi*x), [0,10], file="oscillator.png")
Timing : Nokia N9 (4.8s/2.5s), N900 (8.9s/3.6s)


2D Density plot of complex function of z = re + j*im, here the zeta function :
In [1]: import sympy.mpmath
In [2]: mpmath.cplot(mpmath.zeta, re=[-7, 2], im=[-5, 5], file="zeta.png")
Timing : Nokia N9 (45s/44s), N900 (92s/88s)


3D surface in cartesian coordinates of 2 variables, z = f(x,y), it is by default z colored :
In [1]: import sympy.mpmath
In [2]: mpmath.splot(lambda x, y: 5*x*y*exp(-x**2-y**2), [-2,2], [-2,2], file="surface3D.png")
Timing : Nokia N9 (21s/15s), N900 (47s/36s).


3D parametric surface of 2 variables, x = f(u,v), y = g(u,v), z = h(u,v), here a moebius strip :
In [1]: import sympy.mpmath
In [2]: mpmath.splot(lambda u, v: [(2+(v/2)*cos(u/2))*cos(u), (2+(v/2)*cos(u/2))*sin(u), (v/2)*sin(u/2)], u=[0,2*mpmath.pi], v=[-1,1], file="moebius-strip.png")
Timing : Nokia N9 (22s/20s), N900 (51s/47s).
__________________
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; 2013-08-08 at 00:56. Reason: Added figures
 

The Following User Says Thank You to rcolistete For This Useful Post:
bibek's Avatar
Posts: 368 | Thanked: 826 times | Joined on May 2012 @ India
#33
This is awesome. I'm amazed. Any news about a GUI?
 
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#34
Originally Posted by bibek View Post
This is awesome. I'm amazed. Any news about a GUI?
Yeah, IPython Notebook working on MeeGo Harmattan ! IPython Notebook can be used with SymPy, PyLab, etc.
__________________
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.
 

The Following 2 Users Say Thank You to rcolistete For This Useful Post:
bibek's Avatar
Posts: 368 | Thanked: 826 times | Joined on May 2012 @ India
#35
Originally Posted by rcolistete View Post
Yeah, IPython Notebook working on MeeGo Harmattan ! IPython Notebook can be used with SymPy, PyLab, etc.
I'll be eagerly waiting for release. Please keep us updated. Thanks a lot for ur work. Hats off
 
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#36
Benchmark of SymPy 0.7.2 (it automatically loads PyLab, i.e., NumPy & MatPlotLib) and Sympy 0.7.1 :

Nokia N9 @ 1 GHz with IPython 0.13.1, NumPy 1.4.1 and MatPlotLib 1.0.0 installed :
- "from sympy import *" : 3.5s (v0.7.2), 2.4s (v0.7.2 without MatPlotLib), 2.0s (v0.7.2 without PyLab), 1.7s (v0.7.1);
- isympy in X Terminal : 5.6s (v0.7.2), 4.5s (v0.7.2 without MatPlotLib), 4.1s (v0.7.2 without PyLab), 3.7s (v0.7.1);
- "integrate(x**5/(alpha*x**2+beta)**2,x)" : 3.1s (v0.7.2), 5.6s (v0.7.1);

Nokia N900 @ 600 MHz with IPython 0.10.2, NumPy 1.4.0 and MatPlotLib 1.0.0 installed :
- "from sympy import *" : 8.0s (v0.7.2), 4.1s (v0.7.2 without MatPlotLib), 3.5s (v0.7.2 without PyLab), 2.3s (v0.7.1);
- SymPy icon or isympy in X Terminal : 10s (v0.7.2), 6.1s (v0.7.2 without MatPlotLib), 5.5s (v0.7.2 without PyLab), 4.0s (v0.7.1);
- "integrate(x**5/(alpha*x**2+beta)**2,x)" : 6.6s (v0.7.2), 10s (v0.7.1);

Nokia N810 with IPython 0.10.2 :
- "from sympy import *" : 11s (v0.7.2), 6.5s (v0.7.1);
- SymPy icon or isympy on X Terminal : 16s (v0.7.2), 12s (v0.7.1);
- "integrate(x**5/(alpha*x**2+beta)**2,x)" : 22s (v0.7.2), 31s (v0.7.1);
__________________
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; 2013-08-07 at 04:04.
 

The Following User Says Thank You to rcolistete For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#37
1st post is updated with detailled instructions to install and use SymPy 0.7.2. Also using IPython 0.13.1 Notebook/Qt console with SymPy 0.7.2 is cited for MeeGo Harmattan.

Also post #30 about new plotting module and post #32 with mpmath plotting were updated with more examples and timings for MatPlotLib 1.2.0 & NumPy 1.7.0 on MeeGo Harmattan.

So MeeGo Harmattan has the main scientific Python tools updated with respect to upstream :
- SymPy 0.7.2 (16/10/2012);
- IPython 0.13.1 (21/10/2012), including terminal, Notebook & Qt console interfaces;
- MatPlotLib 1.2.0 (08/01/2013);
- NumPy 1.7.0 (10/02/2013).
Many PC OS distributions are not so updated at the moment.

All of them available directly on Nokia N9/N950 or using it as an IPython Notebook 0.13.1 server for remote web clients (PC's, Nokia N900, Android devices, etc), see post #19 of the IPython for MeeGo Harmattan topic.
__________________
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; 2013-02-14 at 03:06.
 

The Following 3 Users Say Thank You to rcolistete For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#38
SymPy 0.7.3 (upstream version from 14/07/2013) is released today (05/08/2013) for Maemo 4, Maemo 5 and MeeGo Harmattan. See 1st post.

Check the release notes of SymPy 0.7.3, this new version has a lot of improvements and bug fixes. Some of them :
- improved integration with Risch integration algorithm;
- fixed the bug about SymPy always loading NumPy & MatPlotLib;
- fixed the bug about "init_printing(pretty_print=False)" not working;
- The IPython extension, i.e., "%load_ext sympy.interactive.ipythonprinting" (or "%load_ext sympyprinting") is deprecated. Use "from sympy import init_printing; init_printing()" instead inside IPython to obtain pretty printing.
- last version of SymPy to support Python 2.5 (which is the official Python version for Maemo 4 and 5).

SymPy 0.7.3 for Mer / Nemo / Sailfish can be seen in the topic "Python (modules) on Mer/Nemo".

Only in interactive mode (using e.g., "isympy") that SymPy 0.7.3 automatically loads PyLab (NumPy & MatPlotLib).

Benchmarks of SymPy 0.7.3 :

Nokia N9 @ 1 GHz with IPython 0.13.2, NumPy 1.7.1 and MatPlotLib 1.2.1 installed :
- "from sympy import *" : 2.4s;
- isympy in X Terminal : 7.5s (with PyLab), 4.9s (without MatPlotLib), 4.6s (without PyLab);
- "integrate(x**5/(alpha*x**2+beta)**2,x)" : 4.2s.

Nokia N900 @ 600 MHz with IPython 0.10.2, NumPy 1.4.0 and MatPlotLib 1.0.0 installed :
- "from sympy import *" : 4.5s (0.7.3);
- SymPy icon or isympy in X Terminal : 6.4s (with PyLab), 5.8s (without MatPlotLib), 5.5s (without PyLab);
- "integrate(x**5/(alpha*x**2+beta)**2,x)" : 9.1s (v0.7.3).

Nokia N810 with IPython 0.10.2 :
- "from sympy import *" : 16s (v0.7.3), 11s (v0.7.2), 6.5s (v0.7.1);
- SymPy icon or isympy on X Terminal : 22s (v0.7.3), 16s (v0.7.2), 12s (v0.7.1);
- "integrate(x**5/(alpha*x**2+beta)**2,x)" : 35s (v0.7.3), 22s (v0.7.2), 31s (v0.7.1).

The upgrade to SymPy 0.7.3 is recommended for Maemo 4, Maemo 5 and MeeGo Harmattan. It is slower to load but it has many improved features (integration, etc), better IPython compatibility, many bug fixes, etc.
__________________
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; 2014-06-17 at 18:24. Reason: Added Maemo 4 benchmarks.
 

The Following 2 Users Say Thank You to rcolistete For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#39
Some issues about SymPy 0.7.3 for Maemo 5 :
- "Plot()" using PyGlet has some bug that doesn't open the plotting window (this bug also happens on PC's, no only on Nokia N900). This issue was reported to SymPy group and solved by using some SymPy 0.7.2 code for PyGlet "Plot()";
- the new plotting module on SymPy 0.7.3 needs MatPlotLib >= 1.1.0, but Maemo 5 currently has MatPlotLib 1.0.0, so it doesn't work. I will later try to package MatPlotLib 1.2/1.3 for Maemo 5, solving this issue.

Other issues about SymPy 0.7.3 for Maemo 4 & 5 :
- version 0.7.1 of SymPy interactive shell (which has SymPy icon and isympy script) is not compatible with SymPy 0.7.3 (IPython 0.10.2 is not started, only the Python shell), so I've released "SymPy interactive shell" 0.7.3, see 1st post;
- "tests/" subfolders of python-sympy 0.7.3 source code were removed to save installation space, from 31MB to 20MB.

So, on Maemo 5, SymPy 0.7.3 currently has 2 plotting options : PyGlet "Plot()" and mpmath plotting with MatPlotLib.

While on SymPy 0.7.2 there are 3 plotting options : PyGlet "Plot()", new plotting module and mpmath plotting with MatPlotLib. But SymPy 0.7.2 has some bugs (which were fixed in v0.7.3).
__________________
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; 2013-08-09 at 02:26. Reason: More plotting options for SymPy 0.7.3 on Maemo 5
 

The Following 3 Users Say Thank You to rcolistete For This Useful Post:
Posts: 1,269 | Thanked: 3,961 times | Joined on May 2011 @ Brazil
#40
SymPy 0.7.3 and "SymPy interactive shell" 0.7.3 are now available in extras repository for Maemo 4 and extras-devel/extras-testing repositories for Maemo 5, see 1st post.

Please help promote SymPy 0.7.3 for Maemo 5 by voting in extras-testing, see 1st post.
__________________
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; 2013-08-13 at 00:51. Reason: SymPy 0.7.3 in Maemo 4 extras repository
 

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

Thread Tools

 
Forum Jump


All times are GMT. The time now is 08:37.