📜 ⬆️ ⬇️

SageMathCloud - a dream for fans of Python, math and Linux

SageMathCloud (abbreviated SMC) is an online service where you can write a mathematical or any other calculation to Sage or IPython Notebook. Calculations can be combined with HTML, CSS, JavaScript, CoffeeScript, Go, Fortran, Julia, Gap, Axiom, R, Ruby, Perl, Maxima, Maple, Markdown, Wiki (and this is not a complete list!). When editing is supported by multi-cursor, you can enable Vim or Sublime Text bindings. The user is also available Ubuntu console and access to the project via ssh. You can create LaTeX documents and embed Python code in them, which will not be displayed in the final pdf. Ample opportunities allow you to write not just a calculation with 2D and 3D graphics, but a whole interactive application or your own web server on Flask. You can share the calculation for users to edit, and you will see that they are changing and even where their cursor is! With this magnificence, SageMathCloud has open source code that is laid out on Github.




Project Overview


The idea of ​​creating SMC belongs to the professor of mathematics at the University of Washington William Stein . Besides SMC, Harald Schilly (marketing and testing), Keith Clawson (equipment), as well as Jon Lee, Andy Huchala and Nicholas Ruhland (web development) are working.
')
SMC is being developed with grants from the National Science Foundation and Google’s educational grant program .

Currently SMC is in beta testing. Occasionally buggy, but I should note that the stability and usability of the application has grown many times over the two years of my work in it.

Most servers are located in the United States in the University of Washington. There are several servers in Europe. The servers are Ubuntu 14.04.1 LTS (Trusty) with the math program Sage . Also used by the Google App Engine .

The main source of information and a resource for communication is the SMC user forum . Recently, a forum for developers opened after the final transition of SMC to the category of open source projects. Active communication takes place in the Gitter chat ; There is a very informative FAQ on Github.

Every month the number of users is steadily increasing. To date, SMC has over 68 thousand accounts. Detailed statistics on the use of SMC can be found on this page .

Overview of SMC functionality and interface


Sign in


To start using SageMathCloud, go to https://cloud.sagemath.com , register or log in. Unfortunately, occasionally you may receive an error entering the site (usually due to lack of memory for databases). In this case, you can contact the European SMC servers directly with the following ip: 146.148.26.36 and 192.158.29.251 .

Interface elements


Once logged in, you will be taken to a page with a list of projects. The interface elements of this page are presented in the screenshot below (all screenshots are clickable).



Click the Create New Project button to create a new project, and then the project name to enter it. In this case, you will be taken to the file manager and you will see a toolbar at the top of the page, as shown in the screenshot below.



File manager


The screenshot below shows the file manager interface:



I would like to note several important points:

  1. File manager SMC can filter files. For example, by typing pyparsing in the filter, I will only see files that contain the word pyparsing in their name.
  2. The file manager has access to the Linux command line. I usually use this line to create an archive or unpack it. Note that root is locked and there is no tab completion on this line. Below we will see the 2nd way to access the terminal with a working completion.
  3. SMC regularly takes snapshots of the project (the Snapshots button). About two years ago, due to a failure, I lost one file, but through Snapshots I restored it. After this incident, I have not seen such failures.


Project settings: hashtags, co-editing, ssh access, themes, Sublime Text and Vim bindings.


A lot of SMC chips are hidden in its settings, so you should definitely look into them! First, go to the settings of the current project by clicking on the Settings tab. Below is a screenshot of the settings page with explanations.



To get the remaining chips, go to the general settings for all projects by clicking on your e-mail. Below is a screenshot with explanations.



Documents in SMC: Sage Worksheet, Ipython Notebook, LaTeX document, Terminal, Task list and Course.


SMC allows you to work with an extensive type of documents. Go to the New tab.



A few words about "From Internet". Initially, this button worked for any files from other sites. Alas, it so happened that there were many people who abused it. Also, at one time often tried to use the SMC server for mining cryptocurrency. As a result, William Stein wrote a special anti-mining script. Long running processes this script can kill (now, perhaps, this problem is solved). For the same reason, most sites are blocked. I remember that copying works with GitHub and a number of European and US university resources. In principle, you can download the file yourself to your computer and upload it to SMC. If you still need a link to a specific site, then you need to ask William Stein to open access to this site (it's free). To do this, write him a letter or simply create a message with your request on the SMC forum .

In the future, paid features will appear in SMC (it is planned to use Freemium). When they appear, you can unlock access to other sites for money.

Work in Sage Worksheet


First look at Sage Worksheet


Sage Worksheet is the most stuffed with various features. Create a test file sage worksheet. Going to the blank sheet of sage worksheet, you will see another toolbar, a screenshot of which is presented below.



Of the buttons, I usually use Run (calculate), A (increase font) and Save. Especially interesting is the History button. It gives the user a time slider. Moving the slider, you will see how your page with calculations looked before. I have not seen anything more fascinating! Just take a look at the video below (it is silent).



Information strips


Let's write any code and calculate it by pressing the Run button or the shift-enter key combination. Below is a screenshot with an example of python code. Pay attention to the information bars.


Double click on the output (the result of calculations) hides the code, repeated double click displays the code.

Magic teams. Insert html, css, js, etc.


Adding html, css, js, coffescript, markdown, wiki and other goodies is done through the use of magic commands. For a complete list of 56 magic commands, calculate:

%magics 

The full list of magic commands in SMC:
 %auto %axiom %capture %coffeescript %command %cython %default %default_mode %exercise %file %fork %fortran %fricas %gap %gap3 %giac %go %gp %hide %hideall %html %javascript %julia %kash %lie %lisp %load %macaulay2 %magics %magma %maple %mathematica %matlab %maxima %md %mupad %mwrank %octave %pandoc %perl %prun %python %r %reset %ruby %runfile %sage0 %scilab %script %sh %singular %time %timeit %typeset_mode %var %wiki 


Consider for example the use of html and css:



HTML and CSS code
 %html(hide=False) <style> a.hlink { cursor: pointer; } a.hlink:hover { background-color: yellow; } </style> <h3>   : </h3> <ol> <li> <a class="hlink" src="https://habrahabr.ru"></a> </li> <li> <a class="hlink" src="http://www.opennet.ru">Opennet</a> </li> <li> <a class="hlink" src="https://cloud.sagemath.com">SageMathCloud</a> </li> </ol> 


A very short example for Julia:

 %julia println(", !") 


For other cases (markdown, wiki, R, go, etc.) is completely the same.

Code can be loaded using the function load() . An example of a simple graphic form in HTML, CSS and JavaScript in SMC:



Modern web technologies allow embedding 3D graphics into a page without using flash and other plug-ins. In SMC, you can create two-dimensional and three-dimensional graphics using js frameworks, for example, three.js. What is interesting, if you remove the cursor from the 3D area, it is converted into a picture. This approach made working with 3D graphics much more convenient (the page stopped twitching, performance improved). Three-dimensional object can be:

The video below demonstrates working with 3D graphics (video without sound).



Work with terminal


Above, I promised to show the variant of working with the terminal in which autocompletion works. To do this, click the New button, write the name of the file in which the terminal will run (for example, Console) and click the Terminal button. Working in a terminal is almost indistinguishable from working in a regular Linux terminal. The main difference is that root is locked and copy-paste work by ctrl + c and ctrl + v (and not ctrl + shift + c and ctrl + shift + v, as in a regular console). The screenshot below shows the work in the terminal in SMC:



By the way, at one time I used git in this console. It worked well.

You can talk about the possibilities of Sage and SMC for a very long time. In the following articles I will try to highlight in detail the various chips and undocumented features.

Instead of conclusion


Dear users of Habr! Seeing what opportunities for mathematical (and not only) calculations are provided by the user with free software, in particular SageMathCloud, I am sad to see that schoolchildren and students often do not even know about it and use proprietary programs like Mathcad and Matlab. I believe that free software should be the first choice!

If we unite, we can change this state of affairs. In my opinion, you need to do 3 things:

  1. Russify the SMC interface,
  2. Write help and tutorials in Russian,
  3. Tell SMC to your friends and children.

I know that this approach works. For example, CAD Compass is popular in the domestic market because within the framework of one state program Ascona almost every school has given licenses to use this product. Thus, it is necessary to minimize the threshold for the user to enter this software product.

The bulk of the work is writing documentation on SMC in Russian. Last year I began to collect this information on my wikisage.ru resource (please do not consider it an advertisement). I collected material on work in Python and Sage (SMC). The plans - information in Russian about Pyparsing, Numpy, Matplotlib and other Python packages. If you wish, you can help the project with advice or help by writing to the PM, VK or email . My dream is that the majority of schoolchildren, students, scientists and engineers use Sage and Python for their calculations, and this resource has become the main source of information in runet.

Source: https://habr.com/ru/post/247277/


All Articles