WxMaxima is a graphical user interface (GUI) for the Maxima computer algebra system (CAS). WxMaxima allows one to use all of Maxima’s functions. In addition, it provides convenient wizards for accessing the most commonly used features. This manual describes some of the features that make wxMaxima one of the most popular GUIs for Maxima.
Перш ніж ми перейдемо до суті, декілька зауважень щодо навігації підручником. Нижче наведено коротку таблицю змісту. Натискання будь-якого з елементів у списку переведе курсор до початку відповідного розділу підручника. Натискання пункту Зміст переведе курсор до розширеної таблиці змісту. Цією розширеною таблицею можна скористатися для точнішого переходу до окремих частин підручника. У текст буде розташовано посилання на таблицю змісту з навігаційною метою.
WxMaxima basics
Команди, які wxMaxima додає до Maxima
Що робити, якщо wxMaxima працює неправильно
Поширені питання та відповіді на них
Параметри командного рядка, підтримку яких передбачено у wxMaxima
У системі програмного забезпечення з відкритим кодом великі системи, зазвичай, діляться на менші проєкти, з якими простіше працювати невеликим групам розробників. Наприклад, програма для запису компакт-дисків складається з засобу командного рядка, який, власне, виконує запис компакт-диска, і графічного інтерфейсу користувача, за допомогою користувачі можуть виконати потрібні їм дії, не запам’ятовуючи параметрів командного рядка і, загалом, взагалі не маючи справи із командним рядком. Однією із переваг цього підходу є те, що робота з розробки засобу командного рядка може бути використана багатьма програмами: той самий засіб командного рядка для запису компакт-дисків можна використати у додатку надсилання даних на компакт-диск у програмі для керування файлами, для функції «записати на компакт-диск» у музичному програвачі та для запису компакт-диска у програмі для резервного копіювання на DVD. Ще однією перевагою є поділ одного великого завдання на менші частини, що надає змогу розробникам надавати декілька інтерфейсів користувача для однієї програми.
Система комп’ютерної алгебри (СКА), подібна до Maxima, дуже добре вкладається у цю схему. СКА може надавати логіку до програми-калькулятора із довільною точністю обчислень або може виконувати автоматичні перетворення форму у фоновому режимі для більших систем (наприклад, Sage). Крім того, нею можна користуватися і безпосередньо, як самостійною системою. Доступ до Maxima можна отримати з командного рядка. Втім, часто інтерфейси, подібні до wxMaxima, є набагато ефективнішим способом доступу до програмного забезпечення, особливо для початківців.
Maxima є повноцінною системою комп’ютерної алгебри (СКА). СКА — програма, яка може розв’язувати математичні задачі перетворенням формул і визначенням формули, яка розв’язує задачу, замість простого виведення числової форми результату. Іншими словами, Maxima може слугувати калькулятором, який визначає числові значення змінних, а може давати аналітичні розв’язки. Крім того, у програмі передбачено багато обчислювальних методів для аналізу рівнянь і систем рівнянь, які не може бути розв’язано аналітично.
Із докладною документацією до Maxima можна ознайомитися у інтернеті. Доступ до частини цієї документації можна отримати з меню «Довідка» у wxMaxima. Якщо ви натиснете клавішу довідки (у більшості систем це клавіша F1), використання контекстної довідки wxMaxima відкриє для вас сторінку підручника з Maxima із довідкою щодо команди, у якій перебуває курсор.
WxMaxima is a graphical user interface that provides the full functionality and flexibility of Maxima. WxMaxima offers users a graphical display and many features that make working with Maxima easier. For example wxMaxima allows one to export any cell’s contents (or, if that is needed, any part of a formula, as well) as text, as LaTeX or as MathML specification at a simple right-click. Indeed, an entire workbook can be exported, either as a HTML file or as a LaTeX file. Documentation for wxMaxima, including workbooks to illustrate aspects of its use, is online at the wxMaxima help site, as well as via the help menu.
Обчислення, які ви наказуєте виконати wxMaxima у фоновому режимі передаються інструментам командного рядка Maxima.
Призначення більшої частини інтерфейсу wxMaxima є очевидним, але деякі речі потребують більшої уваги. На цьому сайті можна знайти декілька робочих книг, які присвячено різноманітним аспектами роботи у wxMaxima. Опрацювання деяких з цих зразків (зокрема «Десятихвилинного підручника з (wx)Maxima») надасть змогу краще ознайомитися із роботою Maxima і використанням wxMaxima для взаємодії із Maxima. У цьому ж підручнику ми зосередимо увагу на описі тих аспектів wxMaxima, які, ймовірно, є неочевидними і про які немає відомостей у інтернет-підручнику.
One of the very few things that are not standard in wxMaxima is that it organizes the data for Maxima into cells that are evaluated (which means: sent to Maxima) only when the user requests this. When a cell is evaluated, all commands in that cell, and only that cell, are evaluated as a batch. (The preceding statement is not quite accurate: One can select a set of adjacent cells and evaluate them together. Also, one can instruct Maxima to evaluate all cells in a workbook in one pass.) WxMaxima’s approach to submitting commands for execution might feel unfamiliar at the first sight. It does, however, drastically ease work with big documents (where the user does not want every change to automatically trigger a full re-evaluation of the whole document). Also, this approach is very handy for debugging.
Якщо ви почнете вводити якийсь текст у вікні wxMaxima, програма автоматично створить нову комірку робочого аркуша. Тип цієї комірки можна вибрати за допомогою панелі інструментів. Якщо створено комірку з кодом, її вміст може бути надіслано до Maxima. Результат обчислень буде показано під рядком коду. Пару таких команд показано нижче.
При обчисленні вмісту комірки вхідних даних Maxima призначає мітку для вхідних даних (типово, таку мітку буде показано червоним кольором, вона матиме формат %i
). За цією міткою можна посилатися на вміст далі у сеансі роботи з wxMaxima. Виведені Maxima дані також отримають мітку, яка починається з %o
, і яку типово буде приховано, хіба що користувач надасть назву виведеними даним. Якщо надано назву, буде показано визначену користувачем мітку. Втім, можна буде користуватися і автоматично створеною Maxima міткою у стилі %o
.
Окрім комірок для вхідних даних, у wxMaxima передбачено комірки для документації, комірки зображень, комірки заголовків, комірки глав та комірки розділів. У кожної комірки є власний буфер скасовування дій, тому дуже просто діагностувати проблеми, змінюючи значення у комірках і поступово скасовуючи внесені зміни у різних комірках. Крім того, у самого робочого аркуша також є власний буфер скасовування дій, яким може скористатися для скасовування редагувань у комірках, додавання і вилучення комірок.
На рисунку нижче показано різні типи комірок (комірки заголовків, комірки розділів, комірки підрозділів, текстові комірки, комірки введення-виведення та комірки зображення).
The worksheet is organized in cells. WxMaxima knows the following cell types:
Типовою поведінкою wxMaxima при введенні тексту є автоматичне створення комірки формули. Комірки інших типів можна створити за допомогою меню «Комірка», натискання клавіатурних скорочень для пунктів з цього меню або за допомогою спадного списку на панелі інструментів. Після створення нематематичної комірки усе, що введено у файл, вважатиметься текстом.
A (C-style) comment text can be part of a math cell as follows: /* This comment will be ignored by Maxima */
«/*
» позначає початок коментаря, «*/
» — його кінець.
If the user tries to select a complete sentence, a word processor will try to extend the selection to automatically begin and end with a word boundary. Likewise, if more than one cell is selected, wxMaxima will extend the selection to whole cells.
What isn’t standard is that wxMaxima provides drag-and-drop flexibility by defining two types of cursors. WxMaxima will switch between them automatically when needed:
Після запуску wxMaxima, ви побачите лише горизонтальний курсор, який блиматиме. Якщо ви почнете щось вводити, буде автоматично створено математичну комірку, а курсор буде замінено на звичайний вертикальний (ви побачите стрілку праворуч як «запит», а після обчислення вмісту математичної комірки (Ctrl+Enter) ви побачите мітки, наприклад (%i1)
, (%o1)
).
You might want to create a different cell type (using the “Cell” menu), maybe a title cell or text cell, which describes, what will be done, when you start creating your worksheet.
If you navigate between the different cells, you will also see the (blinking) horizontal cursor, where you can insert a cell into your worksheet (either a math cell, by just start typing your formula - or a different cell type using the menu).
The command in a code cell is executed once by pressing CTRL+ENTER, SHIFT+ENTER or the ENTER key on the keypad. The wxMaxima default is to enter commands when either CTRL+ENTER or SHIFT+ENTER is entered, but wxMaxima can be configured to execute commands in response to ENTER.
WxMaxima contains an autocompletion feature that is triggered via the menu (Cell/Complete Word) or alternatively by pressing the key combination CTRL+SPACE. The autocompletion is context-sensitive. For example, if activated within a unit specification for ezUnits it will offer a list of applicable units.
Besides completing a file name, a unit name, or the current command or variable name, the autocompletion is able to show a template for most of the commands indicating the type (and meaning) of the parameters this program expects. To activate this feature press SHIFT+CTRL+SPACE or select the respective menu item (Cell/Show Template).
Комп’ютери традиційно зберігають символи у форматі 8-бітових значень. Це уможливлює існування наборів, що складаються лише із 256 різних символів. У такий набір може бути включено усі літери, цифри та символи керування (завершення передавання, кінець рядка, лінії та кутики для малювання меню тощо) майже будь-якої європейської мови.
For most countries, the codepage of 256 characters that has been chosen does not include things like Greek letters, though, that are frequently used in mathematics. To overcome this type of limitation Unicode has been invented: An encoding that makes English text work like normal, but to use much more than 256 characters.
Maxima allows Unicode if it was compiled using a Lisp compiler that either supports Unicode or that doesn’t care about the font encoding. As at least one of this pair of conditions is likely to be true. WxMaxima provides a method of entering Greek characters using the keyboard:
key | greek letter | key | greek letter | key | greek letter |
---|---|---|---|---|---|
a | альфа | i | йота | r | ро |
b | бета | k | каппа | s | сигма |
g | гамма | l | лямбда | t | тау |
d | дельта | m | мю | u | упсилоn |
e | епсилон | n | ню | f | фі |
z | дзета | x | ксі | c | хі |
h | ета | om | омікрон | y | псі |
q | тета | p | пі | o | омега |
A | Альфа | I | Йота | R | Ро |
B | Бета | K | Каппа | S | Сигма |
G | Гамма | L | Лямбда | T | Тау |
D | Дельта | M | Мю | U | Упсилон |
E | Епсилон | N | Ню | P | Фі |
Z | Дзета | X | Ксі | C | Хі |
H | Ета | Om | Омікрон | Y | Псі |
T | Тета | P | Пі | O | Омега |
У той самий спосіб можна вводити різноманітні математичні символи:
введений рядок | математичний символ |
---|---|
hbar | стала Планка: h із горизонтальною рискою згори |
Hbar | H із горизонтальною рискою згори |
2 | квадрат |
3 | куб |
/2 | 1/2 |
partial | знак частинної похідної (d у dx/dt) |
integral | символ інтеграла |
sq | квадратний корінь |
ii | уявна одиниця |
ee | елемент |
in | включається |
impl implies | випливає |
inf | нескінченність |
empty | порожня множина |
TB | великий трикутник праворуч |
tb | малий трикутник праворуч |
and | і |
or | або |
xor | виключне або |
nand | ні-і |
nor | ні-або |
equiv | еквівалентний |
not | ні |
union | об’єднання |
inter | перетин |
subseteq | підмножина або рівна множина |
subset | підмножина |
notsubseteq | не підмножина або рівна множина |
notsubset | не підмножина |
approx | приблизно |
propto | пропорційне до |
neq != /= або # | не рівне |
+/- або pm | плюс-мінус |
<= або leq | менше або дорівнює |
>= або geq | більше або дорівнює |
<< або ll | набагато менше |
>> або gg | набагато більше |
qed | що і слід було довести |
nabla | набла-оператор |
sum | знак суми |
prod | знак добутку |
exists | знак «існує» |
nexists | знак «не існує» |
parallel | знак «паралельно» |
perp | знак «перпендикулярно» |
leadsto | знак «випливає» |
-> | стрілка праворуч |
–> | довга стрілка праворуч |
If a special symbol isn’t in the list, it is possible to input arbitrary Unicode characters by pressing ESC [number of the character (hexadecimal)] ESC.
Отже, ESC 61 ESC дасть «a».
Please note that most of these symbols (notable exceptions are the logic symbols) do not have a special meaning in Maxima and therefore will be interpreted as ordinary characters. If Maxima is compiled using a Lisp that doesn’t support Unicode characters they might cause an error message.
It may be the case that e.g. greek characters or mathematical symbols are not included in the selected font, then they can not be displayed. To solve that problem, select other fonts (using: Edit -> Configure -> Style).
Shortcuts to the most important Maxima commands, things like a table of contents, windows with debug messages or a history of the last issued commands can be accessed using the side panes. They can be enabled using the “View” menu. They all can be moved to other locations inside or outside the wxMaxima window. Other useful panes is the one that allows to input Greek letters using the mouse.
In the “table of contents” side pane, one can increase or decrease a heading by just clicking on the heading with the right mouse button and select the next higher or lower heading type.
Several word processors and similar programs either recognize MathML input and automatically insert it as an editable 2D equation - or (like LibreOffice 5.1) have an equation editor that offers an “import MathML from clipboard” feature. Others support RTF maths. WxMaxima, therefore, offers several entries in the right-click menu.
WxMaxima offers a set of standard Markdown conventions that don’t collide with mathematical notation. One of these elements is bullet lists.
Звичайний текст
* Один пункт, рівень відступу 1
* Інший пункт на рівні відступу 1
* Пункт на другому рівні відступу
* Другий пункт на другому рівні відступу
* Третій пункт на першому рівні відступу
Звичайний текст
WxMaxima will recognize text starting with >
chars as block quotes:
Звичайний текст
> цитата цитата цитата цитата
> цитата цитата цитата цитата
> цитата цитата цитата цитата
Звичайний текст
WxMaxima’s TeX and HTML output will also recognize =>
and replace it by the corresponding Unicode sign:
cogito => sum.
Other symbols the HTML and TeX export will recognize are <=
and >=
for comparisons, a double-pointed double arrow (<=>
), single-headed arrows (<->
, ->
and <-
) and +/-
as the respective sign. For TeX output also <<
and >>
are recognized.
Більшість клавіатурних скорочень можна знайти у тексті відповідних меню. Оскільки їх взято з тексту меню і, отже, може бути змінено під час перекладу wxMaxima так, щоб вони відповідали потребам користувачів локалізованих клавіатур, ми не наводимо їх у цьому підручнику. Втім, декілька клавіатурних скорочень все ж не документовано у меню:
Якщо текстову комірку буде розпочато з TeX:
у експортованих у форматі TeX даних буде буквально відтворено текст, який вказано після позначки TeX:
. За допомогою цієї можливості можна використовувати розмітку TeX у робочій книзі wxMaxima.
Матеріал, який було отримано під час сеансу роботи у wxMaxima може бути збережено для наступного використання у три способи:
Файли .mac
є звичайними текстовими файлами, які містять команди Maxima. Їх можна прочитати за допомогою команди batch()
або load()
Maxima або пункту меню «Файл/Пакетний файл».
One example is shown below. Quadratic.mac
defines a function and afterward generates a plot with wxdraw2d()
. Afterward the contents of the file Quadratic.mac
are printed and newly defined function f()
is evaluated.
.mac
за допомогою batch()
Увага! Хоча назва файла Quadratic.mac
містить звичайний для Maxima суфікс (.mac
), прочитати дані з нього зможе лише wxMaxima, оскільки команда wxdraw2d()
є wxMaxima-розширенням до Maxima.
Ви можете використовувати файли .mac
для написання власної бібліотеки макросів. Але оскільки у них не міститься достатніх даних щодо структури, їх не можна читати як сеанс wxMaxima.
.wxm files contain the worksheet except for Maxima’s output. On Maxima versions >5.38 they can be read using Maxima’s load()
function just as .mac files can be. With this plain-text format, it sometimes is unavoidable that worksheets that use new features are not downwards-compatible with older versions of wxMaxima.
У цьому заснованому на XML форматі файлів зберігається увесь робочий аркуш, включно із даними щодо масштабу та списком спостереження. Цей формат файлів є рекомендованим.
Для деяких типових змінних налаштувань у wxMaxima передбачено два способи налаштовування:
Частота кадрів анімації, яка використовуватиметься для нових анімацій, зберігається у змінній wxanimate_framerate
. Початкове значення цієї змінної, яке міститиметься у новому робочому аркуші, можна змінити за допомогою діалогового вікна налаштовування.
After the next start, plots embedded into the worksheet will be created with this size if the value of wxplot_size
isn’t changed by maxima.
Щоб встановити розмір графіка для окремого графіка, можна скористатися наведеною нижче конструкцією, яка встановить значення змінної лише для одної команди:
wxdraw2d(
explicit(
x^2,
x,-5,5
)wxplot_size=[480,480]$ ),
За допомогою цього пункту можна увімкнути дві речі:
If this option is set, the file where the worksheet is will be overwritten only the request of the user. In case of a crash/power loss/… a recent backup copy is still made available in the temp directory, though.
Якщо не встановлено цей параметр, wxMaxima поводиться подібно до сучасної програми для мобільних телефонів:
Якщо ви користуєтеся Unix/Linux, дані налаштувань буде збережено до файла .wxMaxima
у вашому домашньому каталозі (якщо ви користуєтеся wxWidgets < 3.1.1), або .config/wxMaxima.conf
((стандартний каталог XDG), якщо використано wxWidgets >= 3.1.1). Визначити версію wxWidgets можна за допомогою команди wxbuild_info();
або пункту меню «Довідка -> Про програму». wxWidgets є бібліотекою графічного інтерфейсу користувача, яка працює на багатьох платформах і є основою wxMaxima (звідси wx
у назві програми). (Оскільки назви файлів починається з крапки, файл .wxMaxima
і каталог.config
є прихованими).
Якщо ви користуєтеся Windows, налаштування буде збережено у реєстрі. Записи wxMaxima можна знайти у цій гілці: HKEY_CURRENT_USER\Software\wxMaxima
WxMaxima is primarily a graphical user interface for Maxima. As such, its main purpose is to pass along commands to Maxima and to report the results of executing those commands. In some cases, however, wxMaxima adds functionality to Maxima. WxMaxima’s ability to generate reports by exporting a workbook’s contents to HTML and LaTeX files has been mentioned. This section considers some ways that wxMaxima enhances the inclusion of graphics in a session.
wxsubscripts
specifies, if (and how) wxMaxima will autosubscript variable names:
If it is false
, the functionality is off, wxMaxima will not autosubscript part of variable names after an underscore.
If it is set to 'all
, everything after an underscore will be subscripted.
If it is set to true
variable names of the format x_y
are displayed using a subscript if
x
or y
is a single letter ory
is an integer (can include more than one character).If the variable name doesn’t match these requirements, it can still be declared as “to be subscripted” using the command wxdeclare_subscript(variable_name);
or wxdeclare_subscript([variable_name1,variable_name2,...]);
Declaring a variable as subscripted can be reverted using the following command: wxdeclare_subscript(variable_name,false);
You can use the menu “View->Autosubscript” to set these values.
Long-running commands can provide user feedback in the status bar. This user feedback is replaced by any new feedback that is placed there (allowing to use it as a progress indicator) and is deleted as soon as the current command sent to Maxima is finished. It is safe to use wxstatusbar()
even in libraries that might be used with plain Maxima (as opposed to wxMaxima): If wxMaxima isn’t present the wxstatusbar()
command will just be left unevaluated.
for i:1 thru 10 do (
/* Повідомляємо користувачу, наскільки далеко зайшли */
wxstatusbar(concat("Pass ",i)),
/* (sleep n) — функція Lisp, якою можна скористатися */
/* із додаванням перед нею символу «?». Команда затримує */
/* виконання програми (у нашому прикладі, на 3 секунди) */
sleep(3)
? )$
Креслення (яке фундаментально пов’язано із графікою) є місцем, де графічний інтерфейс користувача має надавати якісь додаткові можливості до оригінальної програми.
Maxima normally instructs the external program gnuplot to open a separate window for every diagram it creates. Since many times it is convenient to embed graphs into the worksheet instead wxMaxima provides its own set of plot functions that don’t differ from the corresponding maxima functions save in their name: They are all prefixed by a “wx”. For example wxplot2d
corresponds to plot2d
, wxplot3d
corresponds to plot3d
, wxdraw
corresponds to draw
and wxhistogram
corresponds to histogram
.
As noted above, the configure dialog provides a way to change the default size plots created which sets the starting value of wxplot_size
. The plotting routines of wxMaxima respect this variable that specifies the size of a plot in pixels. It can always be queried or used to set the size of the following plots:
wxplot_size:[1200,800]$
wxdraw2d(
explicit(
sin(x),
x,1,10
) )$
Якщо потрібно змінити розміри лише одного креслення, у Maxima передбачено канонічний спосіб зміни атрибута лише для поточної комірки. У цьому випадку до команди wxdraw2d( ) додається специфікація wxplot_size = [значення1, значення2], яка не є частиною команди wxdraw2d.
wxdraw2d(
explicit(
sin(x),
x,1,10
)wxplot_size=[1600,800]$ ),
Setting the size of embedded plot with wxplot_size
works for embedded plots using e.g. wxplot
, wxdraw
, wxcontour_plot
and wximplicit_plot
commands and for embedded animations with with_slider_draw
and wxanimate
commands.
Gnuplot doesn’t seem to provide a portable way of determining whether it supports the high-quality bitmap output that the Cairo library provides. On systems where gnuplot is compiled to use this library the pngCairo option from the configuration menu (that can be overridden by the variable wxplot_pngcairo
) enables support for antialiasing and additional line styles. If wxplot_pngCairo
is set without gnuplot supporting this the result will be error messages instead of graphics.
Якщо креслення було створено за допомогою команд типу wxdraw
(у wxplot2d
і wxplot3d
підтримки цієї можливості не передбачено), і розмір файла базового проєкту gnuplot не є надто великим, wxMaxima пропонує контекстне меню, за допомогою якого можна відкрити креслення у інтерактивному вікні gnuplot.
plot
У MS Windows, якщо у змінній Maxima gnuplot_command
замінити «gnuplot» на «wgnuplot», gnuplot запропонує можливість відкрити вікно консолі, у якому ви зможете вводити команди gnuplot. На жаль, вмикання цієї можливості призводить до того, що gnuplot на короткий період «викрадає» фокусування клавіатури кожного разу, коли готується креслення.
3D diagrams tend to make it hard to read quantitative data. A viable alternative might be to assign the 3rd parameter to the mouse wheel. The with_slider_draw
command is a version of wxdraw2d
that does prepare multiple plots and allows to switch between them by moving the slider on top of the screen. WxMaxima allows to export this animation as an animated gif.
Першими двома аргументами with_slider_draw
є назва змінної, яка покроково змінюватиметься між кресленнями, і список значень цієї змінної. Наступними аргументами є звичайні аргументи wxdraw2d
:
with_slider_draw(
f,[1,2,3,4,5,6,7,10],
title=concat("f=",f,"Hz"),
explicit(
sin(2*%pi*f*x),
x,0,1
grid=true
), );
Доступ до тих самих можливостей для просторових креслень можна отримати за допомогою функції with_slider_draw3d
, яка надає можливість обертати просторові креслення:
wxanimate_autoplay:true;
wxanimate_framerate:20;
with_slider_draw3d(
makelist(i,i,1,360,3),
α,title=sconcat("α=",α),
surface_hide=true,
contour=both,
view=[60,α],
explicit(
sin(x)*sin(y),
x,-π,π,
y,-π,π
) )$
Якщо важливою є загальна форма креслення, може бути достатнім трошки пересунути креслення з метою зробити його просторову природу інтуїтивно зрозумілою:
wxanimate_autoplay:true;
wxanimate_framerate:20;
with_slider_draw3d(
t,makelist(i,i,0,2*π,.05*π),
title=sconcat("α=",α),
surface_hide=true,
contour=both,
view=[60,30+5*sin(t)],
explicit(
sin(x)*y^2,
x,-2*π,2*π,
y,-2*π,2*π
) )$
For those more familiar with plot
than with draw
, there is a second set of functions:
with_slider
іwxanimate
.Normally the animations are played back or exported with the frame rate chosen in the configuration of wxMaxima. To set the speed at an individual animation is played back the variable wxanimate_framerate
can be used:
wxanimate(a, 10,
sin(a*x), [x,-5,5]), wxanimate_framerate=6$
The animation functions use Maxima’s makelist
command and therefore share the pitfall that the slider variable’s value is substituted into the expression only if the variable is directly visible in the expression. Therefore the following example will fail:
f:sin(a*x);
with_slider_draw(
a,makelist(i/2,i,1,10),
title=concat("a=",float(a)),
grid=true,
explicit(f,x,0,10)
)$
А якщо Maxima явно попросити підставити значення повзунка, креслення працюватиме як слід:
f:sin(a*x);
with_slider_draw(
b,makelist(i/2,i,1,10),
title=concat("a=",float(b)),
grid=true,
explicit(
subst(a=b,f),
x,0,10
) )$
While not being provided by wxMaxima this feature of Maxima (on setups that support it) sometimes comes in handily. The following example comes from a post from Mario Rodriguez to the Maxima mailing list:
load(draw);
/* Парабола у вікні 1 */
draw2d(terminal=[wxt,1],explicit(x^2,x,-1,1));
/* Парабола у вікні 2 */
draw2d(terminal=[wxt,2],explicit(x^2,x,-1,1));
/* Параболоїд у вікні 3 */
draw3d(terminal=[wxt,3],explicit(x^2+y^2,x,-1,1,y,-1,1));
Також можна накреслити декілька креслень в одному вікні:
wxdraw(
gr2d(
key="sin (x)",grid=[2,2],
explicit(sin(x),x,0,2*%pi)),
gr2d(
key="cos (x)",grid=[2,2],
explicit(cos(x),x,0,2*%pi))
);
The “Plot using draw” sidebar hides a simple code generator that allows generating scenes that make use of some of the flexibility of the draw package maxima comes with.
Створює каркас команди draw()
, яка малює плоску сцену. Цю сцену пізніше може бути заповнено за допомогою команд, які створюють вміст сцени, наприклад, за допомогою кнопок у рядках під кнопкою «Плоский».
One helpful feature of the 2D button is that it allows to set up the scene as an animation in which a variable (by default it is t) has a different value in each frame: Often a moving 2D plot allows easier interpretation than the same data in a non-moving 3D one.
Generates the skeleton of a draw()
command that draws a 3D scene. If neither a 2D nor a 3D scene is set up, all of the other buttons set up a 2D scene that contains the command the button generates.
Додає стандартне креслення виразу, подібного до sin(x)
, x*sin(x)
або x^2+2*x-4
до команди draw()
, у якій зараз перебуває курсор. Якщо команди draw немає, буде створено двовимірну сцену із кресленням. Кожну сцену можна заповнити довільною кількістю креслень.
Спробувати знайти усі точки, у яких справджуються вирази, подібні до y=sin(x)
, y*sin(x)=3
або x^2+y^2=4
, і накреслити криву-результат за допомогою команди draw()
у поточній позиції курсора. Якщо команди draw виявлено не буде, буде створено плоску сцену із кресленням.
Покроково проходить змінну від нижньої межі до верхньої межі і використовує два виразу, подібні до t*sin(t)
і t*cos(t)
для створення координат точок x, y (у просторових кресленнях використовується і z) кривої, які буде передано до поточної команди draw.
Малює точки, які, якщо вказано, буде з’єднано. Координати точок буде взято зі списку списків, двовимірного масиву або списку масивів для кожної з осей.
Малює заголовок у верхній частині діаграми,
Налаштовує вісі.
(Only for 3D plots): Adds contour lines similar to the ones one can find in a map of a mountain to the plot commands that follow in the current draw()
command and/or to the ground plane of the diagram. Alternatively, this wizard allows skipping drawing the curves entirely only showing the contour plot.
Додає запис умовних позначень із назвою наступного креслення на панель умовних позначень діаграми. Порожнє значення назви вимикає створення записів умовних позначень для наступних креслень.
Встановлює колір лінії для наступних креслень у поточній команді малювання.
Встановлює колір заповнення для наступних креслень у поточній команді малювання.
Відкриває допоміжне вікно, за допомогою якого можна налаштувати лінії сітки.
Надає змогу вибрати адекватну позицію у компромісному питанні «швидкість чи точність?», яке є частиною будь-якої програми для креслення.
Якщо використано формат файлів .wxmx
, вбудовування файлів до проєкту wxMaxima можна виконати простим перетягуванням зі скиданням. Але іноді (наприклад, якщо вміст зображення може бути змінено згодом протягом роботи у сеансі), краще наказати програмі завантажувати файл зображення при обробці команд:
show_image("man.png");
У діалоговому вікні налаштовування wxMaxima передбачено можливість редагування двох файлів із командами, які виконуються під час запуску програми:
maxima-init.mac
wxmaxima-init.mac
Ці файли зберігаються у каталозі користувача Maxima (зазвичай, каталозі maxima
у Windows, .maxima/
у інших системах) у домашній теці користувача. Розташування файлів можна визначити за допомогою такої команди: maxima_userdir;
wxsubscripts
вказує Maxima, чи слід перетворювати назви змінних, які містять символ підкреслювання (R_150
або подібні змінні) на змінні із нижніми індексами. Див. wxdeclare_subscript
, щоб дізнатися більше про те, які саме назви змінних буде перетворено автоматично.wxfilename
: у цій змінній зберігається назва файла, який зараз відкрито у wxMaxima.wxdirname
: у цій змінній зберігається назва каталогу, у якому зберігається поточний відкритий wxMaxima файл.wxplot_pngcairo
визначає те, чи намагатиметься wxMaxima скористатися терміналом pngcairo gnuplot, який надає доступ до ширшого вибору стилів ліній та кращої якості зображення.wxplot_size
визначає роздільну здатність для вбудованих креслень.wxchangedir
: у більшості операційних систем wxMaxima автоматично встановлює для робочого каталогу Maxima каталог поточного файла. Це уможливлює роботу введення-виведення до файла (наприклад, за допомогою read_matrix
) без визначення усього шляху до файла, який має бути прочитано або записано. У Windows ця можливість іноді спричиняє повідомлення про помилку, тому варто встановити для цього параметра значення false
у діалоговому вікні налаштовування.wxanimate_framerate
: частота у кадрах на секунду, із якою відтворюватимуться наступі анімації.wxanimate_autoplay
: типово автоматично відтворювати анімації?wxmaximaversion
: повертає номер версії wxMaxima.wxwidgetsversion
: повертає версію wxWidgets, яку використано у wxMaxima.Функція table_form()
показує двовимірний список у формі, яка є зручнішою для читання, за виведені дані типової підпрограми виведення даних Maxima. Вхідними даними є список одного або декількох списків. Подібно до команди друку, ця команда виводить дані, навіть якщо її завершити символом долара. Завершення команди символом крапки з комою призводить до виведення тієї самої таблиці разом із інструкцією «done».
table_form(
[1,2],
[3,4]
[
] )$
Як показує наступний приклад, списки, які зібрано командою table_form
, можна створювати до виконання команди.
Крім того, оскільки матриця — список списків, матриці можна перетворювати на таблиці у подібний же спосіб.
WxMaxima provides a few functions that gather bug reporting information about the current system:
wxbuild_info()
збирає відомості щодо поточної запущеної версії wxMaximawxbug_report()
надає відомості щодо того, як і де слід повідомляти про вадиMaxima’s box()
command causes wxMaxima to print its argument with a red foreground, if the second argument to the command is the text highlight
.
Since Maxima (the program that does the actual mathematics) and wxMaxima (providing the easy-to-use user interface) are separate programs that communicate by the means of a local network connection. Therefore the most probable cause is that this connection is somehow not working. For example, a firewall could be set up in a way that it doesn’t just prevent unauthorized connections from the internet (and perhaps intercept some connections to the internet, too), but also blocks inter-process-communication inside the same computer. Note that since Maxima is being run by a Lisp processor the process communication that is blocked does not necessarily have to be named “maxima”. Common names of the program that opens the network connection would be sbcl, gcl, ccl, lisp.exe, or similar names.
On Unix computers another possible reason would be that the loopback network that provides network connections between two programs in the same computer isn’t properly configured.
Internally most modern XML-based formats are ordinary zip files. WxMaxima doesn’t turn on compression, so the contents of .wxmx
files can be viewed in any text editor.
If the zip signature at the end of the file is still intact after renaming a broken .wxmx
file to .zip
most operating systems will provide a way to extract any portion of the information that is stored inside it. This can be done when there is a need of recovering the original image files from a text processor document. If the zip signature isn’t intact that does not need to be the end of the world: If wxMaxima during saving detected that something went wrong there will be a .wxmx~
file whose contents might help.
І навіть якщо такого файла не існує — якщо встановлено параметр налаштування для оптимізації файлів .wxmx для системи керування версіями, можна перейменувати файл .wxmx на файл .txt і скористатися текстовим редактором для відновлення частини XML із вмісту файла (він починається з <?xml version="1.0" encoding="UTF-8"?>
і завершується </wxMaximaDocument>
. До і після цього фрагмента тексту у текстовому редакторі ви побачите непридатні до читання двійкові дані).
If a text file containing only these contents (e.g. copy and paste this text into a new file) is saved as a file ending in .xml
, wxMaxima will know how to recover the text from the document.
Зазвичай, wxMaxima очікує, доки буде передано усю двовимірну формулу, перш ніж починає виводити дані. Таким чином заощаджується час, який могло б бути витрачено на постійні спроби вивести незавершену формулу. Втім, існує команда disp
, яка може виводити діагностичні дані негайно, не очікуючи на завершення поточної команди Maxima:
for i:1 thru 10 do (
disp(i),
/* (sleep n) — функція Lisp, якою можна скористатися */
/* із додаванням перед нею символу «?». Команда затримує */
/* виконання програми (у нашому прикладі, на 3 секунди) */
sleep(3)
? )$
Це означає, що wxMaxima не вдалося прочитати файл, який Maxima мала наказати створити gnuplot.
Можливими причинами цієї помилки є такі:
implicit_plot
, але цей пакунок не було завантажено командою load()
Maxima до того, як команду було передано на виконання..gnuplot
у каталозі, на який вказує змінна Maxima maxima_userdir
, містить команди, які Maxima передавала gnuplot. Здебільшого, вміст цього файла є дуже корисним для діагностування проблеми.wxplot_pngCairo
to true from Maxima..png
.The value of the slider variable by default is only substituted into the expression that is to be plotted if it is visible there. Using a subst
command that substitutes the slider variable into the equation to plot resolves this problem. At the end of section Embedding animations into the spreadsheet, you can see an example.
У програмі передбачено окремі функції скасовування дій для дій з комірками і для дій усередині комірок, тому така подія має бути дуже рідкісною. Якщо таке все ж сталося, існує декілька способів відновити дані:
playback();
Однією з можливих причин є те, що Maxima не вдалося знайти у каталозі, який вказано на сторінці «Maxima» діалогового вікна налаштовування wxMaxima, а отже, програму взагалі не запущено. Встановлення адреси коректного виконуваного файла Maxima має виправити цю проблему.
Теоретично можливий випадок, коли wxMaxima не може розпізнати момент завершення обчислень у Maxima і тому ніколи не дізнається про те, що може надсилати нові дані до Maxima. У цьому випадку команда виконання обчислення може відновити синхронізацію між двома програмами.
The Lisp compiler SBCL by default comes with a memory limit that allows it to run even on low-end computers. When compiling a big software package like Lapack or dealing with extremely big lists of equations this limit might be too low. In order to extend the limits, SBCL can be provided with the command line parameter --dynamic-space-size
that tells SBCL how many megabytes it should reserve. A 32bit Windows-SBCL can reserve up to 999 Megabytes. A 64-bit SBCL version running on Windows can be instructed to use more than the about 1280 Megabytes compiling Lapack needs.
Одним зі способів передати Maxima (а отже, SBCL) параметри командного рядка є поле «Додаткові параметри для Maxima» вікна налаштовування wxMaxima.
Встановлення пакунка ibus-gtk
має усунути проблему. Докладніше про це на сторінці (https://bugs.launchpad.net/ubuntu/+source/wxwidgets3.0/+bug/1421558).
Якщо вашу Maxima засновано на SBCL, слід додати такі рядки до вашого файла .sbclrc
:
setf sb-impl::*default-external-format* :utf-8) (
The folder where this file has to be placed is system- and installation-specific. But any SBCL-based Maxima that already has evaluated a cell in the current session will happily tell where it can be found after getting the following command:
:lisp (sb-impl::userinit-pathname)
The worksheet embeds .png files. WxMaxima allows the user to specify where they should be generated:
wxdraw2d(
file_name="test",
explicit(sin(x),x,1,10)
);
If a different format is to be used, it is easier to generate the images and then import them into the worksheet again:
load("draw");
pngdraw(name,[contents]):=
(draw(
append(
[terminal=pngcairo,
dimensions=wxplot_size,
file_name=name
],contents
)
),show_image(printf(false,"~a.png",name))
);pngdraw2d(name,[contents]):=
pngdraw(name,gr2d(contents));
pngdraw2d("Test",
explicit(sin(x),x,1,10)
);
Not directly using Maxima. But there are Gnuplot commands for it:
wxdraw2d(
proportional_axis=xy,
explicit(sin(x),x,1,10)
wxplot_size=[1000,1000]; ),
1 HIToolbox 0x00007ff80cd91726 _ZN15MenuBarInstance22EnsureAutoShowObserverEv + 102
2 HIToolbox 0x00007ff80cd912b8 _ZN15MenuBarInstance14EnableAutoShowEv + 52
3 HIToolbox 0x00007ff80cd35908 SetMenuBarObscured + 408
...
This might be an issue with the operating system. Disable the hiding of the menu bar (SystemSettings => Desktop & Dock => Menu Bar) might solve the issue. See wxMaxima issue #1746 for more information.
Yes. Use the LaTeX package “geometry” to specify the size of the borders.
Ви можете додати такий рядок до преамбули LaTeX (наприклад, за допомогою відповідного поля у діалоговому вікні налаштовування («Експорт->Додаткові рядки до преамбули TeX») для встановлення розміру полів у 1 см):
\usepackage[left=1cm,right=1cm,top=1cm,bottom=1cm]{geometry}
If wxWidgets is new enough, wxMaxima will automatically be in dark mode if the rest of the operating system is. The worksheet itself is by default equipped with a bright background. But it can be configured otherwise. Alternatively, there is a View/Invert worksheet brightness
menu entry that allows to quickly convert the worksheet from dark to bright and vice versa.
WxMaxima delegates some big tasks like parsing Maxima’s >1000-page-manual to background tasks, which normally goes totally unnoticed. At the moment the result of such a task is needed, though, it is possible that wxMaxima needs to wait a couple of seconds before it can continue its work.
(The same problem can occur with other applications too). The translations seem okay after you click on ‘OK’. WxMaxima does not only use its own translations but the translations of the wxWidgets framework too.
These locales maybe not present in the system. On Ubuntu/Debian systems they can be generated using: dpkg-reconfigure locales
You can find these symbols in the Unicode sidebar (search for ‘double-struck capital’). But the selected font must also support these symbols. If they do not display properly, select another font.
Most operating systems provide less complicated ways of starting programs than the command-line so this possibility is only rarely used. WxMaxima still provides some command-line switches, though.
-v
або --version
: вивести дані щодо версії програми-h
або --help
: вивести короткий довідковий текст-o
or --open=<str>
: Open the filename given as an argument to this command-line switch-e
або --eval
: обробити файл після його відкриття-b
or --batch
: If the command-line opens a file all cells in this file are evaluated and the file is saved afterward. This is for example useful if the session described in the file makes Maxima generate output files. Batch-processing will be stopped if wxMaxima detects that Maxima has output an error and will pause if Maxima has a question: Mathematics is somewhat interactive by nature so a completely interaction-free batch processing cannot always be guaranteed.--logtostderr
: Log all “debug messages” sidebar messages to stderr, too.--pipe
: Pipe messages from Maxima to stdout.--exit-on-error
: Close the program on any maxima error.-f
or --ini=<str>
: Use the init file that was given as an argument to this command-line switch-u
, --use-version=<str>
: Use maxima version <str>
.-l
, --lisp=<str>
: Use a Maxima compiled with Lisp compiler <str>
.-X
, --extra-args=<str>
: Allows to specify extra Maxima arguments-m
or --maxima=<str>
: allows specifying the location of the maxima binary--enableipc
: Lets Maxima control wxMaxima via interprocess communications. Use this option with care.--wxmathml-lisp=<str>
: Location of wxMathML.lisp (if not the built-in should be used, mainly for developers).Instead of a minus, some operating systems might use a dash in front of the command-line switches.
wxMaxima is mainly developed using the program language C++ using the wxWidgets framework, as build system we use CMake, a small part is written in Lisp. You can contribute to wxMaxima, join the wxMaxima project at https://github.com/wxMaxima-developers/wxmaxima, if you have knowledge of these programming languages and want to help and contribute to the open source project wxMaxima.
The source code of wxMaxima is documented using Doxygen here.
The program is nearly self-contained, so except for system libraries (and the wxWidgets library), no external dependencies (like graphic files or the Lisp part (the wxmathML.lisp
-file) is needed, these files are included in the executable.
If you are a developer, you might want to try out a modified wxmathML.lisp
-file without recompiling everything, one can use the command line option --wxmathml-lisp=<str>
to use another Lisp file, not the included one.