Freely available math packages for gnu. Mathematical applications FFTW and GNU Octave as a test for processors and PCs. Dependence of results on memory frequency

Accordingly, I could not cover everything - I had about 15 minutes for the report.

Introduction

Famous packages are giants all in one

When we talk about math software, giants like Maple, Mathematica, MatLAB come to mind... They have one thing in common: they try to cover everything. Of course, Mathematica is known primarily as a system for symbolic calculations, and Matlab - for numerical calculations, but at the same time, Mathematica has powerful algorithms for floating point calculations, and Matlab has a package for symbolic calculations. Moreover, these minor The functions in the programs, in comparison with the programs intended for this purpose, look pathetic and ridiculous. And the well-known MathCAD tries to include everything, but everything is implemented so-so. The reason is simple: you cannot embrace the immensity.

Free software does one thing well

In contrast, most free software follows the UNIX philosophy that a program should do one thing, but do it well. There is a lot of free mathematical software, and most of them are designed for a single task. For example, there are programs that only know how to build a mesh for the finite difference method. Or a program that is designed to calculate the digits of Pi. Or a program that can only build graphs, but very well.

However, there are also programs that, to one degree or another, are analogues of well-known packages. I'll talk about three.

Symbolic Computing: Maxima

Project history

I'll start with the history of this project.

First, let me remind you that computers are, in fact, Electronic Computing Machines; they were created for computing with numbers. However, already in the late 50s, the idea appeared that it was possible to make a computer work not only with numbers, but also with algebraic expressions. In the early 60s, the first computer algebra systems began to appear. And, of course, such a system was needed by one peaceful American department (the Department of Energy, which is practically a division of the Pentagon). A tender was announced and it was won by a project called Macsyma (spelled via CS). For many years, DOE Macsyma developed as a government-funded commercial project. In 1982, William Shelter created a fork of Macsyma called Maxima. In the early 90s, the USSR collapsed, the Cold War ended, and an indirect consequence of this was the almost complete cessation of funding for DOE Macsyma. By the end of the 90s, the project practically died down. The Macsyma source code was sold piece by piece and ended up in Maple and Mathematica. In 1998, William Shelter obtained permission from the DOE to publish the Maxima source code under the GPL license. Maxima became free software. Shelter passed away in 2001, but by that time quite a lot of people were already working on Maxima, and they picked up the project.

Interface: command line or wxMaxima

Maxima has a traditional UNIX command line interface, but can also listen to a network port, working as a server. This fact is used by various shells (frontends) that provide a graphical interface. The most common are TeXmacs and wxMaxima. TeXmacs is a scientific text editor in which you can insert a Maxima session into a document. wxMaxima looks something like this:

The latest version, 0.8.0, has become more like Mathematica and Maple: previously the command line for input was separate, at the bottom.

Lisp-like language

The Maxima language takes basic ideas from Lisp, since Maxima is written in Lisp-e. At the same time, it is similar to both the Mathematica and Maple languages, since these programs borrowed many ideas and part of the code from Macsyma. To avoid a long and tedious listing of possibilities, I will give an example of solving typical problems from the first course.

Let the function be given

maxima>> f(x) := x*tanh(x) + x + 1/x + 2;

Let's check whether it is even or odd:

As you can see, the function is neither even nor odd. Let's find the limits of the function at plus or minus infinity:

maxima>> limit(f(x),x,-inf);

maxima>> limit(f(x),x,inf);

So, at plus infinity the function goes to infinity. Does it have an oblique asymptote?

maxima>> limit(f(x)/x, x,inf);

The oblique asymptote is - y=kx+b, and k=2. Let's find b:

maxima>> limit(f(x)-2*x, x,inf);

Finally, let's build a graph:

maxima>> plot2d(f(x), , );

Let's find the derivative of our function:

maxima>> diff(f(x),x);

And at the same time - the indefinite integral:

maxima>> integrate(f(x), x);

The integral didn't work until the end. It can be shown that this integral is not taken in elementary functions. However, Maxima can take some of these integrals using special functions:

maxima>> part: risch(x/(exp(2*x)+1), x);

maxima>> ir: -2*part + log(x) + x^2 + 2*x;

Something terrible. Let's expand the brackets:

maxima>> expand(ir);

Differential equations

Or here is an example of more complex calculations. Suppose we need to solve a differential equation:

maxima>> eq: "diff(y,x) + x*y = 1-x^2;

maxima>> solution: ode2(eq,y,x);

maxima>> expand(solution);

There are a number of Russian-language manuals for Maxima that can be found on the Internet. In my opinion, the most successful introduction with an overview of the capabilities is contained in a series of articles by Tikhon Tarnavsky in the LinuxFormat magazine. Now these articles are posted in the public domain, including on the Russian website Maxima. Unfortunately, documentation on maxima's advanced features is only available in English. The official documentation is 712 pages.

Numerical calculations: Scilab

Scilab is compatible with MatLAB

The most famous package for numerical calculations is MatLAB. Scilab was created as a competitor to matlab, with a more modest pricing policy. However, the project did not justify itself commercially, and the source code was opened under a license similar to the GNU GPL. The scilab language is made as compatible as possible with matlab, so most of your matlab developments will work in scilab. Only now, as you know, the main power of matlab is concentrated in its toolboxes - separately supplied modules. There are also modules for scilab, but there are much fewer of them.

Octave is the GPL equivalent of Matlab

Later, the GNU Octave project appeared, aimed at creating an analogue of matlab, distributed under the GNU GPL without any problems. The language is also practically compatible with Matlab, but there is no analogue of Simulink - a tool for modeling and simulating dynamic systems.

But Octave has a purely console interface (of course, there are also graphical frontends, the most developed is QtOctave), which allows it to be used in scripts, to automate calculations, and simplifies integration into complex software systems. Dozens of extension packages have been written for Octave.

There are articles on Scilab in Russian, in addition, not so long ago the AltLinux publishing house published the book “Scilab: Solving Engineering and Mathematical Problems.” The book can be purchased in the online store, in addition, its electronic version is freely available on the AltLinux website.

Data processing: GNU R

Formally, data processing tools belong to programs for numerical calculations, because all they do is calculations on numbers. However, as you know, a specialized tool is always better than a universal one. Under the words data processing Quite a few different types of activities are hidden: statistical analysis, statistical modeling, sampling only the necessary data, transforming data, constructing various graphs and histograms.

Data processing programs can be categorized by the typical sample size for which they are designed. For small samples, for example, Statistica is suitable. For medium-sized samples, GNU R is well suited (it stores all data in RAM, so on a typical PC we get a limit of 1-2-4 gigabytes). For large and very large volumes of data (from hundreds of gigabytes to hundreds of terabytes), the free PAW and ROOT systems developed at CERN are intended.

GNU R is an interpreted programming language designed for statistical analysis and modeling. R is a free implementation of the long-existing language S. This language is very eclectic, it is in some places similar to C, in others - like Python, in others - like Haskell. For GNU R, there are almost one and a half thousand extension packages (written in R itself, in C or Fortran), collected in the CRAN (Comprehensive R Archive Network) repository.

Data types - numbers, strings, factors, vectors, lists and data tables

The main data types in the language are numbers, strings, factors, vectors, lists and data frames. A factor is data that can take one of several values ​​(gender, wood type, logical type, etc.). Vectors are analogues of arrays - they are a set of several values ​​of the same type; the size of the vector cannot change. It should also be noted that in R there is no scalars; for example, a number is, from the point of view of R, a vector of one element. Lists are a generalization of vectors; they can contain objects of different types, and their length can vary. In addition, you can assign names to individual list elements, and refer to elements not by numbers, but by names. Example:

(assignment in R is usually denoted by the sign , although you can use the more familiar = ; in addition, there is a form value → variable). To refer to list elements by number, double square brackets are used:

Let's assign names to the list elements:

(function c creates vectors). Now you can access list elements by name:

A data table (data frame) in R is a list consisting of vectors. Data tables are most often created by loading from an external file.

This article is the second in a series devoted to various real applications that can be used to test processors, computers, laptops and workstations and which will later form the basis of the new test package iXBT Application Benchmark 2017. Let us recall that in the first article of this series we considered two specialized applications LAMMPS and NAMD, which are used to solve molecular dynamics problems. In this article we will focus on specialized mathematical packages FFTW and GNU Octave. These applications, like LAMMPS and NAMD, are part of the well-known specialized test suite SPECwpc 2.0. Moreover, we borrowed the calculation tasks themselves (workload) and commands for launching programs with the corresponding parameters from the SPECwpc 2.0 package.

FFTW 3.3.5

The GNU Octave environment supports working with script files (), and to run a script the command is used:

octave-cli-4.0.3.exe

(The octave-cli-4.0.3.exe file is located in the C:\Octave\Octave-4.0.3\bin\ folder when installing the package by default.)

For testing, we use a script file that implements operations with loops, calculation of integrals, fast Fourier transform and operations with matrices. We did not write this script from scratch, but took it from the SPECwpc 2.0 package, which includes a test based on GNU Octave. This script is called obench.m. The test result is the execution time of the script.

Test stand and testing methodology

For testing using FFTW and GNU Octave applications, we assembled a bench with the following configuration:

  • Processor: Intel Core i7-6950X (Broadwell-E);
  • Motherboard: Asus Rampage V Edition 10 (Intel X99);
  • Memory: 4x4 GB DDR4-2400 (Kingston HyperX Predator HX424C12PBK4/16);
  • Video card: Nvidia Quadro 600;
  • Storage: SSD Seagate ST480FN0021 (480 GB).

During testing, the time required to complete test tasks was measured.

The dependence of the test results on the number of processor cores used, on the frequency of the processor cores, and on the memory frequency was considered.

Dependence of results on the number of processor cores

The number of cores of the Intel Core i7-6950X processor used during testing was regulated through the UEFI BIOS settings of the Asus Rampage V Edition 10 board. Let us recall that the Intel Core i7-6950X processor is 10-core, but supports Hyper-Threading technology, so the operating system and applications it is seen as 20-core (has 20 logical cores).

We did not disable Hyper-Threading technology and only changed the number of physical processor cores from 1 to 10. In the future, we will talk about logical processor cores, the number of which changed from 2 to 20 in increments of 2.

The operating frequency of all processor cores was fixed at 4.0 GHz.

As you can see, the results turned out to be very strange. Interpreting the results for the GNU Octave package is fairly straightforward. In this package, the speed of completing a test task is practically independent of the number of processor cores, that is, in the Intel Core i7-6950X processor version, even two logical cores are quite enough to complete the test task. As the number of available processor cores increases, the task is parallelized, but the load share of each core decreases in proportion to their number. As a result, the speed of execution of the test task does not change as the number of processor cores increases.

But with the FFTW application everything is very strange and illogical. With 6, 12 and 14 cores (logical), the execution time of the test task becomes abnormally long. In other cases, the test task execution time is approximately the same. The result is quite strange, but it has been rechecked many times.

If you look at the CPU load during test execution, the situation is as follows. First, the task is parallelized across all processor cores. Secondly, at some periods of time the load on the processor cores is low, and at other times it is high. Moreover, this behavior is observed for any number of cores. And why, with a certain number of processor cores, the test execution time becomes abnormally large is unclear.

We conducted further research into this strange behavior of the test. To do this, we disabled Hyper-Threading technology on the processor and repeated testing in the FFTW application, changing the number of physical processor cores from 1 to 10. The test results are as follows:

With Hyper-Threading technology disabled, the result was even more illogical. With 3, 5, 6, 7 and 9 cores, the test execution time was large, and with 1, 2, 4, 8 and 10 cores it was short. That is, it turns out that the efficiency of parallelizing a task depends on the number of processor cores, but not at all in the sense that a larger number of cores improves the result. With a certain number of cores, the task is parallelized well, but with a certain number, it is poorly parallelized.

However, we still had doubts about the correctness of our conclusions, since in this case we were not talking about a real two-, four-, six-, and so on core processor, but about artificially blocking the cores through the motherboard BIOS. We decided to repeat the test with another processor - a six-core (12 logical cores including Hyper-Threading) Intel Core i7-5820K. As we have seen, with 6 physical or 12 logical processor cores, the test execution time becomes abnormally high. And this result was confirmed on the Intel Core i7-5820K processor. The processor ran at 3.6 GHz. With all cores with Hyper-Threading technology activated (12 cores), the test task execution time is abnormally long: 1886 s. If you turn off the cores sequentially, then with 10, 8, 4 and 2 cores the test execution time is 200-400 s, and with 6 cores - 1235 s.

As you can see, the same strange result is obtained on the Intel Core i7-5820K processor as on the Intel Core i7-6950X processor.

Despite this strange dependence of the FFTW test results on the number of processor cores, we decided to leave it in the package of applications that will be used in the iXBT Application Benchmark 2017. This application clearly demonstrates that many cores are not always good. Sometimes it happens differently.

Perhaps in the final version we will reduce the size of the Fourier transform itself in order to exclude cases where such a test lasts more than 30 minutes.

Dependence of results on processor frequency

Now let's look at how testing results in FFTW and GNU Octave applications depend on processor frequency.

The core frequency of the Intel Core i7-6950X processor was changed in the UEFI BIOS settings of the Asus Rampage V Edition 10 board by changing the multiplying factor. The operating frequency of all cores was fixed (that is, Turbo Boost mode was disabled). All processor cores were used (10 physical/20 logical). The frequency varied from 3.0 GHz to 4.2 GHz in 200 MHz steps. The test results are as follows:

As can be seen from the test results, both in the FFTW package and in the GNU Octave package, the test execution time depends on the processor frequency. In the FFTW package, when the processor frequency increases from 3 to 4.2 GHz (40% increase), the test execution time decreases by 21%. In the GNU Octave package, a similar increase in processor frequency leads to a 24% reduction in execution time for test tasks.

Thus, the dependence of the FFTW and GNU Octave test results on the processor frequency is quite typical. The test task in the GNU Octave package scales slightly better with processor frequency, and the task in the FFTW package scales slightly worse.

Dependence of results on memory frequency

Now let's look at the dependence of the speed of execution of test tasks on the frequency of memory operation. DDR4 memory operated in four-channel mode (one module per channel), and the memory frequency was changed in the UEFI BIOS settings in the range from 1600 MHz to 2800 MHz in steps of 200 MHz. Memory timings were fixed and did not change when the frequency changed. All processor cores ran at 4.0 GHz.

The test results are as follows:

As we can see, the speed of execution of test tasks in the GNU Octave and FFTW packages does not depend in any way on the memory operating frequency. At least in the four-channel operating mode, the DDR4 memory bandwidth is quite sufficient even at a frequency of 1600 MHz, and further increasing the memory frequency does not allow speeding up the execution of test tasks.

This is a typical result for most applications. Applications whose operating speed depends on memory frequency are rather an exception to the rule.

Conclusion

So, in the second article of our new series, we looked at two tests based on specialized mathematical applications FFTW and GNU Octave. Using the 10-core Intel Core i7-6950X processor as an example, it was shown that the test tasks in these packages are parallelized across all processor cores, but cannot load them 100%. The test result in the GNU Octave application is practically independent of the number of processor cores, while the test result in the FFTW application, on the contrary, strongly depends on the number of processor cores, but this dependence is very strange. At a certain number of cores (14, 12 and 6), the execution time of the test task becomes abnormally large, and in all other cases the execution time of the test task depends only slightly on the number of cores.

In addition, it was shown that the speed of execution of test tasks in the FFTW and GNU Octave packages linearly depends on the frequency of the processor cores (when the frequency changes in the range from 3 to 4.2 GHz).

Finally, it was shown that the execution time of test tasks in FFTW and GNU Octave applications does not depend in any way on the DDR4 memory frequency (in quad-channel mode and in the range from 1600 to 2400 MHz).

There is one more note that can be made regarding FFTW and GNU Octave applications when using them for testing. The GNU Octave package has poor repeatability and it is advisable to do five runs of the test to obtain a result with low error. The FFTW application gives more consistent results, but this application also requires at least three test runs.

In the next article in this series, we will look at three applications that are used to render 3D scenes: POV-Ray 3.7, LuxRender 1.6 and Blender 2.77a.

  • Tutorial

# wget https://dl.fedoraproject.org/pub/epel/7/x86_64/ # yum localinstall epel-release-6-7.noarch.rpm

And only after that yum install octave will work.
Finally, everything is ready and the program is installed.


# octave GNU Octave, version 3.8.2 Copyright (C) 2014 John W. Eaton and others. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, type "warranty". Octave was configured for "x86_64-redhat-linux-gnu". Additional information about Octave is available at http://www.octave.org. Please contribute if you find this software useful. For more information, visit http://www.octave.org/get-involved.html Read http://www.octave.org/bugs.html to learn how to submit bug reports. For information about changes from previous versions, type "news". octave:1>

Matrix Operations

Let's not waste time and do operations that can be repeated using bc and awk, which were discussed last time. Let's play a little with matrices.


First a simple matrix transpose:


octave:1> A= A = 1 3 5 2 4 6 octave:2> A" ans = 1 2 3 4 5 6

Let's try to solve a system of linear equations:


x + y + z = 9 2x + 4y - 3z = 1 3x + 6y - 5z = 0

We drive in the matrix A, vector b and solve the equation Ax = b in matrix form


octave:1> A= A = 1 1 1 2 4 -3 3 6 -5 octave:2> b= b = 9 1 0 octave:3> x=A\b x = 7.00000 -1.00000 3.00000

We find the determinant and eigenvalues ​​of the matrix.


octave:4> det (A) ans = -1.00000 octave:5> eig (A) ans = -2.88897 2.76372 0.12525

Complex numbers are also supported in calculations.


octave:6> A=[-3 0 2; 1 -1 0; -2 -1 0] A = -3 0 2 1 -1 0 -2 -1 0 octave:7> x=det (A) x = -6 octave:8> y=eig(A) y = -1.00000 + 1.41421i -1.00000 - 1.41421i -2.00000 + 0.00000i

Functions and Variables

In Octave, variables and functions are much easier to create than, for example, in Java or C. Using matrices as an example, we have already seen how to declare variables. Creating a new function has the following syntax


function = function_name (arg1, arg2, ..., argN) function body endfunction
As a rule, a new function is created either in a separate file or in an Octave script file
before her first call. If you intend to use a custom function in different script files, then, of course, it is preferable to create it in a separate file. In GNU Octave, function files have the extension .m and are loaded automatically. The file name must strictly match the function name.

Let's write a function to solve the quadratic equation ax² + bx + c = 0


octave:9> function = quadr(a, b, c) > D = sqrt(b^2-4*a*c); > x1 = (-b-D)/(2*a); > x2 = (-b+D)/(2*a); > endfunction octave:10> =quadr(a, b, c) y1 = 2 y2 = 3

Graphical interface

Actually, we are talking about command line mathematics here, but it is not yet clear how to display the function graph on the screen. However, there is no secret here - Gnuplot is used for these purposes. You can depict the Lorentz Attractor by installing the additional package odepkg.


function = froessler (vt, vx) vyd = [- (vx(2) + vx(3)); vx(1) + 0.2 * vx(2); 0.2 + vx(1) * vx(3) - 5.7 * vx(3)]; endfunction A = odeset("MaxStep", 1e-1); = ode78 (@froessler, , , A); subplot(2, 2, 1); grid("on"); plot (t, y(:,1), "-b;f_x(t);", t, y(:,2), "-g;f_y(t);", \ t, y(:,3 ), "-r;f_z(t);"); subplot(2, 2, 2); grid("on"); plot (y(:,1), y(:,2), "-b;f_(xyz)(x, y);"); subplot(2, 2, 3); grid("on"); plot (y(:,2), y(:,3), "-b;f_(xyz)(y, z);"); subplot(2, 2, 4); grid("on"); plot3 (y(:,1), y(:,2), y(:,3), "-b;f_(xyz)(x, y, z);");


The most convenient graphical shell for working with Octave is the QtOctave program. The latter has already been stabilized and included in the package since the release of Octave 4.0.

What's next?

The question may arise: why do we need open mathematical packages at all? Everyone needs office applications, but not everyone needs to solve Poisson's equations using the Laplace transform while sitting at home. For universities, MATLAB is much cheaper than for individuals and commercial organizations. Commercial organizations, if necessary, will find funds, and let ordinary people study mathematics at universities or count in columns.


Of course, this is a misconception. Scientific calculations performed using open source software have an additional “level of protection”, because if desired anyone can repeat the same calculations and check the validity of the results. The same calculations performed on expensive software partially cut off the possibility of checking the results. The problem is actually much broader (English text) and it is not just about open or proprietary mathematical programs. It is no secret that scientific journals, as a rule, do not require authors to provide data and methods sufficient to guarantee the repetition of experimental results and model testing. Economists and financiers especially often sin with this, simply classifying their data. Checking calculations and conclusions among a selection from an array of articles with “classified” data Add tags

Free mathematics

Alexander Bikmeev understands how free computer mathematics is and how free software is mathematical.

Any science, from physics to philology, uses the achievements of mathematics. In this regard, non-mathematical specialists need tools that would allow them to pose problems in mathematical form and obtain solutions in the form of formulas or a set of values, that is, they need computer mathematics systems that can take on the work of solving mathematical problems using various methods.

Unfortunately, in our country such programs are common in a rather narrow area of ​​scientific activity, and not least of all this is due to the fact that schoolchildren and students are not introduced to professional mathematical packages, the cost of just one license for which often amounts to thousands and tens of thousands of rubles.

We invite you to take a look into the world of free mathematical packages that can be downloaded for free from the Internet, used for any type of research (sometimes with reservations), and also, thanks to the availability of source texts, study their internal structure and, if desired, expand their functionality with your own forces.

Symbolic calculations

Computer mathematics (CM) systems have been developed for a long time, and Maxima() was one of the first. Initially it was a commercial product, but, unable to withstand the competition, the system became free.

Shell wxMaxima and a menu item that allows you to display or hide the mathematical operations panels from the screen.

Main advantage Maxima ahead of other free systems is support for symbolic computation. That is, by entering an analytical expression or equation, you can also get the result in analytical form.

Maxima allows you to solve algebraic equations, systems of equations, perform operations of integration, differentiation, series expansion, and so on. In addition, she can solve differential equations, boundary value problems, Cauchy problems, perform algebraic calculations with matrices, build graphs and surfaces defined by various functions in Cartesian and polar coordinate systems. It is difficult to list all the possibilities.

For SCM Maxima Several shells have been developed, the most convenient of which (for a novice user) is wxMaxima(see Fig. 1). Starting from version 0.8.0, it is rapidly changing for the better. The latest version (0.8.3) contains features of such well-known commercial packages as Maple And MathCAD. Working in this shell is quite simple and allows you to get acceptable results after just a few minutes of use. Many operations, the names of which are present in the menu and on toolbars, are equipped with convenient wizards that allow you to solve problems even without knowing the built-in language and commands Maxima. Well, one more important fact - all shells for this SCM are Russified. Also, by looking at the free package Maxima, students will be able to more easily get used to commercial packages, which is due to both the relative similarity of the interface and the syntax used (especially for Maxima And Maple).

The system is well documented, but reference material is presented only in English. Our magazine published educational materials about working at SCM Maxima(LXF81–86). Being a console application, Maxima can work in batch mode, that is, you can send it a text file with a list of commands for processing and again receive a text file with the results, and if you consider that the output can be formatted using the markup system TeX, then this allows you to use it as a basis for building your own applications. One example of such development is the extension TeXmacs.

Based on existing learning experience, we can say that junior year students master working in Maxima quickly enough and begin to use it when completing assignments in other subjects. But with each course they have more and more problems.

The fact is that, along with a large number of positive aspects, Maxima there are also negative ones. Firstly, the final result, especially when solving complex problems, largely depends on the level of knowledge of mathematics and experience in using a given SCM, because sometimes you need to perform preliminary transformations yourself. Secondly, Maxima works very well with algebraic expressions, but has significant difficulty with transcendental, logarithmic, and similar expressions. However, if it is impossible to obtain an analytical solution, then you can always use numerical calculations. Thirdly, opportunities Maxima for constructing complex graphs or visualization, for example, a vector field, cannot be compared with the capabilities Maple. And finally, fourthly, for proper work it is necessary to study numerous commands and constants Maxima, and this takes time and patience.

SCM Maxima included in many Linux distributions, or at least required to be present in the repositories. It is included in such educational products as AltLinux School, Edubuntu and EduMandriva.

Window SMath Studio, in which the function is defined, its derivative is calculated and a graph is plotted.

It should be noted that engineers are still accustomed to working with such a powerful calculator application as MathCAD. This is an engineering calculation system available for any platform (see Commercial packages), but at a serious cost. However, employers require that graduates be able to work in this system. What should educational institutions do?

A saving project was born in our country: SMath Studio(http://ru.smath.info/forum/). This is a free, but, unfortunately, not yet free product, the developer of which, Andrey Ivashov, is trying to create an alternative to the monster MathCAD, and he succeeds (see Fig. 2). The application is designed for the environment .NET, and then adapted for Mono.

SMath Studio allows you to perform analytical calculations, matrix operations, plotting and derivative calculations, and even supports programming functions. Unfortunately, analytical integration is not yet supported, but the product is developing successfully, and in the fall of 2009 the author is completing the development of an infrastructure that will allow the use of third-party plug-ins. Perhaps then the development of the application will reach a new level, and we will get a full-fledged alternative MathCAD.

It should also be noted that in the spring of 2009, by agreement with the author, the product was included in the educational distribution EduMandriva. Despite its limited functionality, this application allows you to perform everyday calculations at the level of schoolchildren and junior students, as well as simple engineering calculations. And if you consider that SMath Studio feels great on pocket computers and smartphones controlled by Windows Mobile, so getting to know it is a must for schoolchildren and students.

The official website always contains documentation in DOC and ODT formats, and on the official forum you can ask questions to the developer or community and discuss the algorithms used in developing the application.

Window wxMaxima with the results of symbolic calculations and the graph of the function

To conclude this section, I would like to draw attention to the fact that symbolic mathematics packages produce an expression, not a number, as a result. Consider the example shown in Fig. 3, in which a custom function is defined and the second derivative is found for it; then the function is integrated. At the same time, a schedule was created. Thus, schoolchildren and students can visually perform a complete analysis of the function. And that's not all: Maxima knows how to simplify expressions by opening parentheses, bringing similar terms, performing substitutions and specifying certain conditions and assumptions imposed on the expression. Add to this the ability to symbolically solve equations and systems of equations, as well as differential equations, and you will understand that the modern student cannot do without these tools, and science teachers can enliven lessons and practical exercises by introducing interactive tasks or demonstration material.

Numerical calculations

As you know, not every problem can be solved analytically, that is, a solution can be obtained in the form of a certain formula. Then various numerical methods come to the rescue to obtain a solution with some accuracy. The most famous representative of applications for numerical calculations is the computer algebra system (CAS) Matlab.

Matlab widespread throughout the world (see comparison in LXF109), but the cost of even educational licenses is beyond the means of not only schools, but also many Russian universities. Abroad they also prefer to count money - and invest human resources in the development of free analogues Matlab. Let's look at some of them.

First of all, in my opinion, it is worth focusing on the project GNU Ostave(http://www.gnu.org/software/octave/). The developers position this system as “a high-level programming language for numerical calculations.” Like many long-standing free *nix projects, it provides a command line interface. Enter in terminal octave– and (if, of course GNU Octave installed on your computer), a prompt for this system will appear in front of you. Start typing commands and the terminal will display the results of the calculations.

The command line interface has its advantages, since it practically does not take up the computer’s computing resources, leaving all the power of the processor for the calculations themselves, and not for the beautiful display of command text and calculation results. And yet the modern user is rarely willing to put up with this.

. Shell qtOctave with the calculations performed.

For a long time GNU Octave didn't have a graphical interface until it finally appeared qtOctave(see Fig. 4). This shell is very similar to the interface Matlab and allows you to automate the execution of some routine operations (for example, plotting) using wizards.

The system language is made as similar as possible to the language Matlab; therefore, a person who has mastered GNU Octave, will be able to work practically without retraining in Matlab, and this is exactly what employers need. In addition, enthusiasts of the free software movement have created a sufficient number of extension packages for the system. Due to this, the functionality of the SKA itself is constantly growing. Well, the presence of comprehensive documentation (albeit in English) both for the system and for extension packages makes this product not only profitable, but also accessible for study.

The disadvantages include the not very user-friendly shell interface qtOctave, especially since the version has not been updated since the fall of 2008 (it seems that the project has been abandoned). Extension packs are not rich in functions and do not shine with graphical capabilities; in addition, they are not equivalent, since the situation is such that one project was developed by a first-year student, and the second, for example, by a team of university teachers. But this is a completely free project, with which you don’t have to worry about the licensing purity of the resulting solutions.

The next package that I would like to consider is called Scilab(http://www.scilab.org), the very name of which indicates similarity with Matlab. Initially it was also a commercial product, and it was called Blaise, and then Basile. Its creators were inspired by the first versions Matlab, and they competed for some time. However, in the early 90s, Simulog stopped selling it, and then six developers of the French National Research Institute (INRIA) founded the project Scilab.

Scilab stands out from its peers in its well-developed interface, the presence of a fairly large number of specialized extension packages, and the fact that it is supported by the Consortium Scilab, which includes major educational and scientific institutions from around the world.

Interface Scilab 5

Scilab- the only free system similar Matlab, which has its own block modeling tool called Scicos. The product distribution includes a built-in script and function editor with debugging capabilities. Scilab has advanced graphics capabilities for creating high-tech applications. You can familiarize yourself with the functionality of the system by looking at the demos - some of them are quite impressive (select menu items ? > Demonstration of capabilities).

Scilab contains functions not only for performing all kinds of operations on matrices, but also for constructing graphs and three-dimensional surfaces in various coordinate systems, functions for working with genetic algorithms, solving problems on graphs, statistical functions, simulation tools and much more. Several conferences dedicated to the use of SKA are held annually Scilab in science, education and production.

Several books have been published around the world describing work in Scilab, as well as solving a number of specialized problems. Unfortunately, none of them have been translated into Russian. Only two books were published in Russia, one as part of a national project, and the second Scilab described along with non-free packages. Our magazine has also repeatedly published textbooks on working in Scilab(LXF106–109 and ), and yet documentation is still lacking, and reference materials do not always allow you to understand how this or that function works.

Freemat- an impressive result of what a team of three like-minded people is capable of.

Release of the fifth version Scilab marked the beginning of a new stage in the development of the system. The application interface has changed (the developers abandoned GTK-interface), the block modeling tool began to change Scicos, which in October 2009 should change its name to Xcos.

Another variation on the theme Matlab is Freemat(); this package has another important common feature with Matlab, namely support for object-oriented programming. The program interface is quite pleasant. Autocompletion of commands is implemented in the main window. The official website contains a complete manual for working with the system (in English). The program distribution package is small, by today's standards, in size - 18 MB.

The system allows for the numerical solution of equations and systems of equations, both linear and nonlinear, and numerical signal processing (see Fig. 6); capable of working with multidimensional matrices. Main positive points Freemat, compared to Scilab And Octave, are greater compatibility of the internal language of the system with the language Matlab and use OpenGL to create graphs and surfaces, making them look better.

The downsides Freemat are low performance (some tasks are solved many times slower than in other packages) and the lack of extension packages. This system is developed only through the efforts of a team of three people. The project does not have a large community.

Distance mathematics

The systems mentioned above are local projects, that is, work with them is carried out on one machine. But this can be inconvenient - for example, with distance learning; In addition, not all students will agree (and sometimes will be able) to install these applications on their home computers. In this case, tools are needed for remote work with mathematical packages.

SMath Studio Live: calculate without leaving the browser (albeit not very quickly).

Among those we have considered, such an opportunity is provided by SMath Studio. In chapter Live The official website (http://smath.info/live) contains a virtual worksheet on which anyone can perform their calculations. The system is very convenient, although it is not particularly fast.

And yet the system is more professional in this regard SAGE(http://www.sagemath.org/). This system consists of a web server that provides a graphical interface for interacting with the code Python, on which its core is written. Any user using his favorite web browser can connect to the server, register and get his personal space. It can be either open or closed, that is, accessible only to the server administrator and the owner himself. Worksheets can be created in the personal space, and all calculations are performed on them.

Within the worksheet, you can use any available language, and there are many of them. System default SAGE combines the following products: GAP, Maxima, Python, R, LaTeX. In addition, they can be connected Octave, Axiom, Magma, Mathematica, Matlab, Maple, Mupad and others. As a result, we get a single remote work server that allows us to teach any mathematical packages and perform calculations using both free and commercial computer mathematics systems.

. For unknown reasons, Sage refuses to work in Firefox, but otherwise this is a good solution for remote work.

The system of access rights to personal spaces and the ability to collaborate with a worksheet by several users at once allows you to organize distance learning with a sheet of explanation of educational material containing examples of problem solving, and sheets of personal assignments for each student.

There are currently several public SAGE-servers - you can connect to them, look at sheets posted in the public domain, create your own personal space and, in case of difficulties, ask for help from the community. To do this, simply make the worksheet public. I assure you: there are a lot of people willing to help, the only problem is that the working language is English.

The official website contains links to a test public server (http://www.sagenb.org), as well as educational materials and books created using this system. Register and try it out SAGE– maybe this is what you are looking for? It is also worth noting that we were unable to log into the server in Firefox, but there were no problems in other browsers.

So, we looked at the most popular free computer mathematics systems. Whether they can be used in training and for work is up to you to decide. We have already made our choice, and we do not regret it.

Commercial systems

Among commercial systems, the three most popular are: Matlab(numerical calculations), Maple(the main emphasis is on symbolic calculations) and Mathematica(successfully combines the aspirations of the first two). The powerful engineering package stands out MathCAD, since it is more of a large engineering calculator, and it is not intended for solving complex problems of mathematical physics or the theory of encryption, signal processing, and so on.

All these packages have versions for the most common platforms: Windows, Linux and Mac OS X. Here is the cost of one license of these packages for academic institutions, according to the Softline price list:

  • Matlab– 30,765 rubles;
  • Mathematica– 9002 rubles;
  • Maple– 36,286 rubles;
  • MathCAD– 5290 rub.

You can draw your own conclusions.