CoCalc -- Collaborative Calculation in the Cloud
Sharedsupport / 2016-09-21-111819-parametric.sagewsOpen in CoCalc

Examples for support purposes...

cmsel = [colormaps.autumn(_) for _ in sxrange(0,1,0.05)]
S=parametric_plot3d([2*r*cos(t), sqrt(2)*r*sin(t), 4 + (2*r*cos(t))^2 - 2*(sqrt(2)*r*sin(t))^2],
                    (r,0,1),(t,0,pi/2), adaptive=True, color=cmsel[2], plot_points=10, opacity=0.9)
(r, t)
3D rendering not yet implemented

var("x y z")
T(x,y,z) = sin(2*y + 3*z)^2
cm = colormaps.gist_rainbow
g = implicit_plot3d(x^2 + y^2 + z^2, (x,-2, 2), (y,-2, 2), (z,-2, 2), contour=2, color=(T, cm), plot_points=4)
show(g, viewer='tachyon')
(x, y, z)
3D rendering not yet implemented
   File: /projects/sage/sage-7.3/local/lib/python2.7/site-packages/smc_sagews/
   def sh(code):
    Run a bash script in Salvus. Uses jupyter bash kernel
    which allows keeping state between cells.


    Use as a block decorator on a single line::

        %sh pwd

    and multiline

        echo "hi"
        ls -l

    You can also just directly call it::


    The output is printed. To capture it, use capture

        %sh pwd

    After that, the variable output contains the current directory

    Remember shell state between cells

        cd /tmp
        ... new cell will show settings from previous cell ...
        echo $FOO

    Display image file (this is a feature of jupyter bash kernel)

        display < sage_logo.png

    .. WARNING::

        The jupyter bash kernel does not separate stdout and stderr as cell is running.
        It only returns ok or error depending on exit status of last command in the cell.
        So all cell output captured goes to either stdout or stderr variable, depending
        on exit status of the last command in the %sh cell.
    if sh.jupyter_kernel is None:
        sh.jupyter_kernel = jupyter("bash")
    return sh.jupyter_kernel(code)