Seal of Good Local Governance (SGLG) 2024Final.pptx
Maxima - minimalism in mathematics
1. Maxima - minimalism in mathematics.
Among software for mathematical calculations, most widely known are
such universal package-combines as Mathcad, Mathematica, Maple, etc. . These
systems are a powerful tool for students and teachers, engineers and scientists.
They allow to do calculations in your thesis, research paper or report with minimal
effort Calculations are the most routine and attention-consuming tasks. According
to their functionality, these systems can be called a programming environment,
with the only difference being that programming language elements here are
familiar mathematical notations.
However, they all have a drawback - you have to pay for them!
The program presented in the review, considering its functionality is not
much inferior to such monsters as Mathcad or Mathematica, but the most
important thing about it is that it is not commercial or closed-source. In other
words, this review is about free software.
2. The project, known today as Maxima, was born in the late 60s in the
legendary MIT (Massachusetts Institute of Technology), when as part of the project
on MAC artificial intelligence (Machine Aided Cognition) they started developing
symbolic computation program, which received the name Macsyma (from MAC's
SYmbolic MAnipulation). The system architecture was developed by July 1968,
while programming itself began in July 1969. Lisp was chosen as the language for
developing the system.
The program has been used and developed for many years at the
universities in North America having introduced a variety of system versions.
Maxima is one of these versions, created by Professor William F. Schelter
in 1982. In 1998, he received official approval from the US Department of Energy,
which was in charge of the project, to use Macsyma source code under the GNU
Public License and as a result, in 2000 he initiated Maxima project, Macsyma's
successor.
The principles underlying the project were later adopted by the most
actively developing commercial programs now - Mathematica and Maple. We can
say that Macsyma actually has become the ancestor of the entire school symbolic
mathematics software.
3. Maxima itself is a console program, and all the mathematical formulas
are displayed with ordinary text characters. there are at least two pluses here. On
the one hand, Maxima itself can be used as a core to build on top of it graphical
interfaces for every taste. On the other hand, by its nature , without any interface
add-ons, Maxima has no hardware requirements and can work on such machines
that no one regards them as computers (this may be relevant, for example, for a
university or a scientific laboratory with a budget too tight to upgrade their
computers, while still needing a symbol computing software).
Let's switch to the program. Installing it, you will be offered two graphical
shells: wxMaxima and XMaxima. The former interface exempts you from dialing
functions manually, so you can use the menu or panel, which is very helpful in
setting additional options.
The basic functionality of the system is greatly expanded by specialized
packages designed to work with dimensional values, additional functions to work
with matrices, and graphs, etc. They are included into system installation package
and to work with them, you must additionally download the necessary package
during operation.
4. After starting the system, you can see an invitation to enter the first
command. First, let's calculate the expression.
co s
𝜋
4
To do this, in the input line, type "cos (% pi / 4);" and press Shift + Enter.
In Maxima, % pi as well as “% e” symbols denote well-known
mathematical constants.
All information is entered and stored in cells. There are input cells that
are marked with the letter i (input) and output cells that are marked with the letter
o (output). The system automatically numbers each input and output, so that each
cell has a unique label. The label is a cell name enclosed in parentheses: (%i1),
(%o23) where n is the nth number of the input (or output) cell. Input cells are
highlighted in red, output cells are highlighted in orange.
5.
6. If a mathematical expression ends with a ";", then this is a requirement
for calculating a mathematical expression and displaying the result in the
document. Note that this symbol is automatically added by the system at the end
of the expression when you press <Enter>. If wxMaxima is used, then the
terminating ";" is not obligatory, however in the shell XMaxima, as well as in the
command line, a semicolon after the calculated expression is required.
If the output of calculation result is not needed, then the input ends
with a "$" symbol. In this case, the output cell is not displayed. But the cell itself is
created, and it will contain the result of the calculation, which allows you to refer
to it if necessary.
There can be several commands in one line, but each of them will still
have its own output cell. At the same time, each command (except the last one)
should be terminated either with";" or with "$" symbol.
Whatever expressions Maxima works with, the software always strives
to display the results in an exact analytical form. In order to get the answer as a
floating point number, you must specify this explicitly. The simplest way is to set
the “numer” option by separating it with a comma from the entered expression:
7. The names of functions and variables in Maxima are case-sensitive, it
means that the software differentiates between , the upper and lower case letters,
so the system does notcalculate t "Cos (% pi / 4)" instead of "cos (% pi / 4)".
Two functions are used for plotting - plot2D (two-dimensional) and
plot3D (three-dimensional). Using these two functions allows you to display
different graphs on a plane and in space with a long list of settings to make them as
highly customizable as possible. With the help of special operators or function
arguments, you can set a number of grid nodes for a graph to be built on, , data
ranges, color and other characteristics.
The following expression builds in the wxMaxima workspace the graphs
of two functions: sin (x) and cos (x) over the interval from -5 to 5. The intervals for
displaying the graph and additional options are indicated in square brackets,
separated by commas.
(%i3) wxplot2d([sin(x),cos(x)], [x,-5,5], [y,-2,2], [gnuplot_preamble, "set
zeroaxis;"]);
8.
9. Generally speaking, graphical functionality
capabilities is not built into Maxima, but implemented through
external programs. By default, the gnuplot program is used for
plotting, but, besides it, there is openmath developed together
with Maxima and included in itspackage. Actually, when using
the "plot2d" function, the gnuplot window will open, in which
the necessary graph is plotted. The function "wxplot2d" is used
to build graphs only in the wxMaxima shell. However, when
using this shell for plotting graphs, and not only them, it is
much more convenient to use the menu or toolbar buttons. The
Maxima export format is rather poor: images in the program
are saved, in fact, only in PostScript. Generally speaking, the
system visualization tools are very, very modest, although they
allow to get high-quality graphics of some types.
The system allows you to create custom variables and
functions.
To assign values to variables, use the symbol ":".
If some character already has a value, then it can still
be used in the expression. The “ ’ ” symbol is used for this: its
application before any symbol or expression prevents the
expression from being calculated.
10. However, you should pay attention to the following. If an apostrophe is
used before the function name, then the calculation of the function itself is
blocked, not its arguments,. If you put an apostrophe before the expression and
put it in parentheses, then the whole expression as a whole, that is, all the
functions that are included in it, and all the arguments of these functions will not
be calculated. In the terminology of the system, the non-calculated form of the
expression is called "noun form", and the calculated one is called "verb form".
11. In the Maxima system it is possible to give names to any expressions.
Some can say that we assign values to variables with the only difference that any
mathematical expression can be a value of such a variable. For the assignment
operation, a colon is used - the equal sign is left to the equations, which,
considering the orientation to the mathematical recording, is easier and more
familiar.
After we assign an expression to a variable, we can use it at any time, for
example, when calculating the first derivative:
or indefinite integral:
and even to solve an algebraic equation:
12. The same "solve" function can also be used to solve systems of algebraic equations
To solve more complex equations, use the "find_root" function:
In brackets, after the variable name, an interval is entered within which
the root is calculated - in this case from -1 to 1.
To calculate a user-defined function, after writing the name of the
created function , the combination of the characters ": =" is used.
For example:
13. The Maxima system, like all “hardcore” computer algebra systems, allows us to
solve ordinary differential equations of the first and second orders, as well as their
systems. For this, depending on the purpose, two functions are used. For the
general solution of ordinary differential equations, the function “ode2” is used, and
the function “desolve” is used to find solutions of equations or systems of
equations with respect to initial conditions.
To denote derivatives in differential equations, the “diff” function is used. But in
this case, in order to display the dependence of a function on its argument, it is
written in the form of “ 'diff (f (x), x)”, and the function itself - f (x).
Example. Find the general solution of the ordinary first order differential equation
“y '- ax = 0”.
14. Another solution to the ordinary differential equations of the first and
second orders is designed to search for solutions with initial conditions given. It is
implemented using the “desolve” function. Initial values for a variable are provided
by the “atvalue” function.
Example. Find the solution of the first order differential equation “y '= sin
(x)” with the initial condition.
Note that in the absence of the initial condition, the function will also work and
will produce the result:
15. Note that in the absence of the initial condition, the function will also
work and will produce the result:
This allows you to test the solution for a specific initial value. Indeed,
putting the value “y (0) = 4” into the result obtained, we just get “y (x) = 5 - cos(x)”.
16. The “desolve” function makes it possible to solve systems of differential
equations with initial conditions.
We give an example of solving a system of differential equations.
𝑥′ 𝑡 = 𝑥 𝑡 − 1
𝑦 𝑡 ′ = 𝑥 𝑡 + 2 ∙ 𝑦 𝑡 − 3
with initial conditions “x(0) = 0; y(0) = 1”.
17. We consider numerical methods for solving differential equations on the
example of the Runge-Kutta method.
We solve the system of differential equations:
𝑥′
(𝑡 = 𝑐𝑜 𝑠( 𝑡
𝑦′
𝑡 = 𝑠𝑖 𝑛( 𝑡
Under the following initial conditions
{x0=0; y0=4}
Solution:
18.
19. Consider line by line how the solution is obtained:
(1) sol: rk ([cos (t), - sin (t)], [x, y], [0.4.0], [t, 0.4.0.1]) $
(1) the solution of the system of differential equations is assigned to the variable
sol
(2) list1: makelist ([p [1], p [2]], p, sol);
(2) for further work (displaying results, for example), create an array list1 with the
values of the function x(t) in the range from 0 to 4 with a step of 0.1
(3) list2: makelist ([p [1], p [3]], p, sol);
(3) for further work (displaying results, for example), create an array list1 with
values of the function y(t) in the range from 0 to 4 with a step of 0.1
(4) plot2d ([[discrete, list1], [discrete, list2]], [xlabel, "t"], [ylabel, "y"], [legend,
"one", "two"]) $
(4) drawing the results in a separate window. You can use the “wxplot2d”
command to display in the workspace. There were added options to display labels
and legends.
20. Consider other graphical shell system Maxima.
The XMaxima interface is much more primitive than that of wxMaxima
and is a window divided into two parts: the upper part is the working area, and the
lower part is the help.
However, the top of asceticism is the console interface.
On the screen, the commands you enter and the system responses to
them alternate. The interface is fairly straightforward, but, nevertheless, all
formulas, even quite complex ones, are quite readable. Graphs of functions can
only be displayed in separate windows - just like in any of the graphical interfaces.
In my opinion, the only real plus of the console interface is the minimum resource
requirements.
21. Maxima is a professional system designed to solve fairly complex
mathematical problems, as well as for graphical data display Undoubtedly, Maxima
falls short of such commercial products as Mathcad or Mathematica, but its
advantages – free status and small size make the Maxima system a good tool to use
both for educational purposes and for simple engineering calculations.