View Single Post
Posts: 1,229 | Thanked: 3,723 times | Joined on May 2011 @ Brazil
Good news for Maemo 5 users ! SymPy can now make graphics with the easy-to-use 'Plot()' function. And 'preview()' function also works (partially).

Maemo 5 users need to install the optional dependency "PyGlet", see how to install it in the 1st post of this topic.

The SymPy 'Plot' section of the SymPy for smartphones & tablets site has a lot of links, hints, tips and examples.

The new version of SymPy for Maemo 5 (see post below) shows after "?Plot" the following keyboard controls (stylus controls translation for 2D graphics and rotation for 3D graphics), where the 'SHIFT' modifier is used for smooth movements of 3D plots :

    Plot Window Keyboard Controls
    Screen Rotation:
        X,Y axis      Arrow Keys, A,S,D,W, Numpad 4,6,8,2
        Z axis        Q,E, Numpad 7,9
    Model Rotation:
        Z axis        Z,C, Numpad 1,3
    Zoom:             R,F, PgUp,PgDn, Numpad +,-
    Reset Camera:     X, Numpad 5
    Camera Presets:
        XY            F1, G
        XZ            F2, H
        YZ            F3, J
        Perspective   F4, K
    Sensitivity Modifier: SHIFT
    Axes Toggle:
        Visible       F5, T
        Colors        F6, Y
    Close Window:     ESCAPE
    Screenshot:       F8, I
On Maemo 5, labels on axes and axes tick marks don't work, so, don't use "axes='label_ticks=true; label_axes=true'" inside 'Plot()'.

Examples of SymPy 'Plot()' :

Function of 1 variable, y = f(x), a dumped harmonic oscillator :
In [1]: Plot(2.5*exp(-1.0*x/2)*cos(pi*x), [0,10,150], width=800, caption='Dumped harmonic oscillator')
Timing : 12s / 2s (repeated).

2D parametric function of 1 variable, x = f(t), y = g(t), an explosion :
In [1]: Plot(t*sin(8*t)*cos(8*t)*cos(t), t*sin(8*t)*cos(8*t)*sin(t), [0,4*pi,1600], width=800, caption='Parametric Explosion', axes='stride=1.0')
Timing : 57s / 17s (repeated).

3D parametric curve of 1 variable, x = f(t), y = g(t), z = h(t), a wire 3D curve :
In [1]: Plot((2+cos(16*t))*cos(t), (2+cos(16*t))*sin(t), sin(16*t), [800], axes='colored=true', width=800, caption='Wire 3D curve')
Timing : 51s / 9s (repeated).

3D surface in cartesian coordinates, z = f(x,y), a surface z colored :
In [1]: Plot(5*x*y*exp(-x**2-y**2), [-2,2,100], [-2,2,100], 'color=zfade4', axes='colored=true', width=800, caption='Surface z colored')
Timing : 36s / 30s (repeated).

3D surface in cylindrical coordinates, r = f(theta=t,z=h), a wormhole :
In [1]: Plot(z**2/4+1, [], [z,-3,3], 'mode=cylindrical; style=both; color=zfade4', axes='colored=true', width=800, caption='Wormhole surface')
Timing : 25s / 16s (repeated).

The SymPy 'preview()' function partially works on Maemo 5. For example :
In [1]: preview(integrate(sin(x)**15,x),output='dvi',euler=False)
works on Nokia N900 with TeXLive and Evince installed. The PNG and PDF outputs don't work because there are no 'dvipng' and 'dvipdf' in Maemo 5 (but there is 'dvipdfm' and 'dvipdfmx' which can be manually used or a link can be created from one of them to '/usr/bin/dvipdf'). PS output is created but not show by Evince.
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 ---
2 Jolla 1, Jolla C, Jolla Tablet. 2 Nokia N9. Nexus 4 with Sailfish. Nokia N900 & N810.

Last edited by rcolistete; 2013-01-16 at 04:23. Reason: Labels on axes problem on Maemo 5 is cited

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