maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & MeeGo Harmattan & Sailfish (https://talk.maemo.org/showthread.php?t=78568)

dschwertb 2012-03-10 18:33

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
Quote:

Originally Posted by rcolistete (Post 1177527)
Help me understand : what about double press on Fn (blue arrow above Shift) to obtain numbers and other symbols ?

That's OK for simple calculations, if you don't need the decimal point.
Without the decimal point you get integer calculations...
Also, if you want to use variables for interim results, you have to switch all the time.


(Sometimes, I'm using scripts for standard calculations where I accept inputs like '1?1' for '1.1' to avoid switching. Maybe I should add the decimal point to the X Terminal keys, but then it still would not be too comfortable to use Python as calculator with interim results.)


Regards,

Dietmar

rcolistete 2012-04-14 16:52

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
Thanks everybody, SymPy is now promoted to Maemo 5 extras repository and Maemo.org Downloads for Maemo 5.

rcolistete 2013-01-05 22:01

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
I've written some blog post related to SymPy :

- "Scientific Python for computers, tablets and smartphones" shows that Nokia N900 and Nokia N9 are the best smartphones to run scientific Python softwares : IPython, NumPy/MatPlotLib, SymPy, etc;

- "Symbolic computation CAS (Computer Algebra System) for smartphones and tablets" shows that SymPy is present in almost all smartphones and tablets which run CAS, and Nokia N900 and Nokia N9 are the best smartphones for SymPy using.

rcolistete 2013-01-07 03:01

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
SymPy 0.7.2 package is now available for MeeGo Harmattan :
python-sympy_0.7.2-1harmattan1_all.deb (2.3 MB).
Using a file manager, tap in the .deb file to install it (taking 26 MB).

Check the release notes of SymPy 0.7.2, this new version has a lot of improvements and bug fixes. Some of them :
- improved integration methods, e.g., some integrals are faster in v0.7.2;
- plotting module using MatPlotLib, so now we can easily use SymPy to make 2D/3D plots on MeeGo Harmattan;
- I am now co-author of SymPy (in the authors list) for a small contribution about implementing "num_columns" in "init_printing" and "pretty"/"pretty_print"/"pprint", an useful feature for displaying SymPy results in small screens of smartphones and tablets.

SymPy release history on MeeGo Harmattan :
* SymPy 0.7.2 Harmattan1 (03/01/2013) :
- SymPy 0.7.2 (16/10/2012) version for MeeGo 1.2 Harmattan;
- about 26 MB after install;
* SymPy 0.7.1 Harmattan-2 (13/11/2011) :
- added SymPy tests;
- about 19 MB after install;
* SymPy 0.7.1 Harmattan-1 (06/11/2011) :
- SymPy 0.7.1 (29/07/2011) 1st version for MeeGo 1.2 Harmattan;
- about 13 MB after install.

Application manager information about SymPy 0.7.2, which takes 11.9 MB of installed files + 14 MB of compiled (.pyc) Python files (during installation) :
http://www.robertocolistete.net/sympy/SymPy-N9-app.png

The SymPy v0.7.2 was packaged in 104s on a Nokia N9 running Harmattan SDK on chroot, see the topic "Compiling & packaging on MeeGo Harmattan device".

I will later update the 1st post, post new screenshots, benchmarks, examples of using the new plotting module, etc.

(Done) SymPy 0.7.2 will also be released for Maemo 4 & 5.

rcolistete 2013-01-09 21:59

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
SymPy 0.7.2 package (see previous post) is now also available for Maemo 4 Diablo :
python-sympy_0.7.2-1maemo1-m4_all.deb (2.3 MB)
and Maemo 5 Fremantle :
python-sympy_0.7.2-1maemo1_all.deb (2.3 MB).
Install them using "$ dpkg -i <file.deb>" in X Terminal as root. They will be available in the Maemo's repositories after Maemo Extras builder comes back to working again.

SymPy 0.7.2 for Maemo 4/5 takes approx. 25 MB after installation.

Then follow the instructions of 1st post to install "SymPy interactive shell" and IPython for Maemo 4 / 5.

Use on Maemo 5 :
SymPy 0.7.2 now automatically loads PyLab (NumPy + MatPlotLib) if it is installed. As Maemo 5 has NumPy and MatPlotLib available in Extras/Extras-Devel repositories, the time to load SymPy 0.7.2 (using "from sympy import *") on a Nokia N900 @ 600 MHz will be different, approximately :
* 3.5s without NumPy & MatPlotLib installed;
* 4.1s with only NumPy installed;
* 8.0s with both NumPy & MatPlotLib installed.
The SymPy icon or the terminal command "isympy" launches the IPython interactive shell, adding more 2.0s.

To install NumPy and MatPlotLib on Maemo 5, use the X Terminal as root with Extras-Devel repository enabled :
# apt-get install python-numpy python-matplotlib
Then follow the topic "Can not use matplotlib in ipython" to configure MatPlotLib.

Use on Maemo 4 :
As Maemo 4 doesn't have NumPy and MatPlotLib, SymPy 0.7.2 can't (automatically) load them. The time to load SymPy 0.7.2 (using "from sympy import *") on a Nokia N810 is approximately 11s. Using the SymPy icon or the terminal command "isympy" then takes 16s.

Both SymPy v0.7.2 for Maemo 4 and Maemo 5 were packaged in approx. 63s on a Nokia N900 using PyPackager.

(Done) I will later update the 1st post, post new screenshots, examples of using the new plotting module, etc.

khan.orak 2013-01-09 23:21

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
I don't see the crowd here but

SIR rcolistete you have done an amazing job. Kudos. Superb.

Ken-Young 2013-01-10 00:44

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
Quote:

Originally Posted by khan.orak (Post 1313054)
I don't see the crowd here but

SIR rcolistete you have done an amazing job. Kudos. Superb.

Please allow me to echo this sentiment. I use SymPy on my N900 absolutely every day. It's my default calculator now. Thank you very much indeed, rcolistete!

sifo 2013-01-10 01:33

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
Quote:

Originally Posted by khan.orak (Post 1313054)
I don't see the crowd here but

SIR rcolistete you have done an amazing job. Kudos. Superb.

I agree with you, and i think they're busy because of this thread
talk.maemo.org/showthread.php?t=66470&goto=newpost

@rcolistete
you have done a very good work in this, thank you for supporting Maemo

khan.orak 2013-01-10 04:07

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
Quote:

Originally Posted by sifo (Post 1313075)
I agree with you, and i think they're busy because of this thread
talk.maemo.org/showthread.php?t=66470&goto=newpost

@rcolistete
you have done a very good work in this, thank you for supporting Maemo

Lol ... Spot on... S** app is the need of the day then?? :D

I must say, SymPy, is a one hell of an app for Professionals related to Engineering/Sciences... Such great stuff this fella has brought to Maemo Fremantle/MeeGo Harmattan.

One THANKS is not enough.

rcolistete 2013-01-16 01:43

Re: [Announce] SymPy (Computer Algebra System) for Maemo 4 & 5 & 6
 
The 1st post cites the new plotting module of SymPy 0.7.2, which depends on MatPlotLib and is available on Maemo 5 and MeeGo Harmattan.

Documentation and examples for SymPy 0.7.2 plotting module :
- plotting module documentation;
- 6 examples/tutorials in IPython notebook format in the "examples/beginner" github folder, with names starting with "plot_".

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

Observations about MatPlotLib 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.
- Maemo 5 and MeeGo Harmattan, plotting commands without the option "show=False", or using the function "show()", opens the interactive backend of MatPlotLib on your N900;
- Maemo 5 has MatPlotLib v1.0.0 which is not 100% compatible with sympy.plotting 3D graphics, so "plot3d_parametric_line", "surface_color" option for 3D plots, don't work;
- 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).

2D Plot of a function of 1 variable, y = f(x), a dumped harmonic oscillator :
In [1]: oscillator_plot = plot(2.5*exp(-1.0*x/2)*cos(pi*x), (x,0,10), title='Dumped harmonic oscillator', legend=True, xlabel='x', show=False)
In [2]: oscillator_plot.save("oscillator.png")
Timing : Nokia N9 (2.9s/2.6s), N900 (6.1s/4.0s).
http://www.robertocolistete.net/Pyth...oscillator.png

2D parametric function of 1 variable, x = f(t), y = g(t), here an explosion. The "line_color" option can be a constant or a function of parameter (here the radius). The sampling is changed from the default adaptive to 1600 points.
In [1]: from sympy.plotting import plot_parametric
In [2]: explosion = plot_parametric(t*sin(8*t)*cos(8*t)*cos(t), t*sin(8*t)*cos(8*t)*sin(t), (t,0,4*pi), title='Parametric Explosion', xlabel='x', ylabel='y', show=False)
In [3]: explosion[0].line_color = lambda x, y : sqrt(x**2 + y**2)
In [4]: explosion[0].adaptive = False
In [5]: explosion[0].nb_of_points = 1600
In [6]: explosion.save("explosion.png")
Timing : Nokia N9 (5.1s/4.0s), N900 (16s/9.8s).
http://www.robertocolistete.net/Pyth..._explosion.png

2D parametric plot of 1 variable (t), where x = r*cos(t), y = r*sin(t), with r the polar coordinate. Here r = cos(4*t), i.e., a polar rose with 8 petals :
In [1]: from sympy.plotting import plot_parametric
In [2]: polar_rose = plot_parametric(cos(4*t)*cos(t), cos(4*t)*sin(t), (t,0,2*pi), title='Polar Rose', show=False)
In [3]: polar_rose[0].line_color = lambda t : cos(t)
In [4]: polar_rose.save("polar-rose.png")
Timing : Nokia N9 (5.6s/2.7s), N900 (11.5s/4.8s).
http://www.robertocolistete.net/Pyth...polar-rose.png

3D parametric curve of 1 variable, x = f(u), y = g(u), z = h(u), here a 3D wire. We changed the line color to follow the parameter and the sampling from 300 default points to 800 points.
"plot3d_parametric_line" needs MatPlotLib >= 1.1, e.g. MatPlotLib 1.2.0, so only available on Nokia N9/N950.
In [1]: from sympy.plotting import plot3d_parametric_line
In [2]: wire3D = plot3d_parametric_line((2+cos(16*t))*cos(t), (2+cos(16*t))*sin(t), sin(16*t), (t,0,2*pi), title='Wire 3D curve', xlabel='x', ylabel='y', show=False)
In [3]: wire3D[0].line_color = lambda t : t
In [4]: wire3D[0].nb_of_points = 800
In [5]: wire3D.save("wire3D.png")
Timing : Nokia N9 (7s/6s).
http://www.robertocolistete.net/Pyth...ric3D-wire.png

3D surface in cartesian coordinates of 2 variables, z = f(x,y), it is by default z colored and has 50 x 50 domain points :
In [1]: from sympy.plotting import plot3d
In [2]: surface3D = plot3d(5*x*y*exp(-x**2-y**2), (x,-2,2), (y,-2,2), title='Surface z colored', xlabel='x', ylabel='y', show=False)
In [3]: surface3D.save("surface3D.png")
Timing : Nokia N9 (11s/10s), N900 (57s/57s).
http://www.robertocolistete.net/Pyth...-z-colored.png
The "surface_color" option (needs MatPlotLib 1.2.0, available only on Nokia N9/N950) is here a function of the radius and the domain is changed to 100 x 100 points :
In [1]: from sympy.plotting import plot3d
In [2]: surface3D = plot3d(5*x*y*exp(-x**2-y**2), (x,-2,2), (y,-2,2), title='Surface z colored', xlabel='x', ylabel='y', show=False)
In [3]: surface3D[0].surface_color = lambda x, y : sqrt(x**2 + y**2)
In [4]: surface3D[0].nb_of_points_x = 100; surface3D[0].nb_of_points_y = 100
In [5]: surface3D.save("surface3D-2.png")
Timing : Nokia N9 (40s/37s).
http://www.robertocolistete.net/Pyth...-colored-2.png

3D parametric surface of 2 variables, x = f(u,v), y = g(u,v), z = h(u,v), here a moebius strip, it is by default z colored and has 50 x 50 domain points :
In [1]: from sympy.plotting import plot3d_parametric_surface
In [2]: u, v = symbols('u v')
In [3]: moebius_strip = plot3d_parametric_surface((2+(v/2)*cos(u/2))*cos(u), (2+(v/2)*cos(u/2))*sin(u), (v/2)*sin(u/2), (u,0,2*pi), (v,-1,1), title='Moebius strip', xlabel='x', ylabel='y', show=False)
In [4]: moebius_strip.save("moebius-strip.png")
Timing : Nokia N9 (11s/10s), N900 (95s/95s).
http://www.robertocolistete.net/Pyth...bius-strip.png
The "surface_color" option (needs MatPlotLib 1.2.0, available only on Nokia N9/N950) is here a function of "u", and the domain is changed to 100 x 20 points :
In [1]: from sympy.plotting import plot3d_parametric_surface
In [2]: u, v = symbols('u v')
In [3]: moebius_strip = plot3d_parametric_surface((2+(v/2)*cos(u/2))*cos(u), (2+(v/2)*cos(u/2))*sin(u), (v/2)*sin(u/2), (u,0,2*pi), (v,-1,1), title='Moebius strip', xlabel='x', ylabel='y', show=False)
In [4]: moebius_strip[0].surface_color = lambda u : cos(u)
In [5]: moebius_strip[0].nb_of_points_u = 100; moebius_strip[0].nb_of_points_v = 20
In [6]: moebius_strip.save("moebius-strip-2.png")
Timing : Nokia N9 (10s/8s).
http://www.robertocolistete.net/Pyth...us-strip-2.png


All times are GMT. The time now is 06:17.

vBulletin® Version 3.8.8