back to the main page

mavscript


With Mavscript you can do calculations in a text document.

déversoir.odt out.déversoir.odt
Fig. 1: Template Fig. 2: Mavscript output

The following file formats are supported:
File format with limited support: Mavscript runs on LINUX, Windows, Mac OS X and other platforms.

How it works

Mavscript reads the calculation commands in the template. These commands start with the control characters §m and end with one of the following control characters: §i, §o, §io und §n. Their meaning will be explained later. The commands are forwarded to the Computer-Algebra-System (Yacas). The algebra program returns an answer to Mavscript, i.e. the result of the calculation command. Mavscript now can insert this answer in the text, where the command was. When all calculations are done Mavscript saves the text document in a new file out-template. The template file remains unchanged.

You do not always want to replace the calculation command by the answer from the algebra program. When you assign a value to a variable you usually want that the command remains in the text. Therefore there are the following possibilites.

Input in the template file Output Notes
-------------------------- ------ -----

§m l:=5 §i l:=5 The command remains unchanged. §i stands for input.
§m b:=4 §i b:=4 The control characters are removed.
§m h:=2 §i m h:=2 m

§m V:=l*b*h §io V:=l*b*h --> 40 Both the input and the output are shown.
§m 2 + 3*4 §io 2 + 3*4 --> 14 §io stands for input/output.

§m doubleVol := 2*V §n Sometimes you do not want to show the command or its result.
§m gl:=x^2-l^2 §n §n stands for nothing.

§m doubleVol §o 80 Only the return value (answer) is shown. §o stands for output.
§m Solve(gl,x) §o {x==5,x==(-5)} This is useful if you want to separate the calculation and
the results.

Some rules:


Usage


screenshot input screenshot output           jEdit

  1. Create a template (input) file: template.txt or template.odt
  2. Drag the template file with the mouse on the Mavscript-icon on the desktop.
  3. A window opens and the calculation is executed.
  4. Open the output file (out-template.txt or out-template.odt).
Mavscript can also be used from the command line (shell, konsole, terminal, command prompt, DOS-window).

Mavscript vs. spread sheet applications

The goal of Mavscript is to allow calculations in a text document. Mainly Mavscript is used where spread sheet applications are not that much suitable: The mathematical functionality may be insufficient (algebra!) or the calculations are to much hidden (hard to debug, hard to understand for others). In such cases the use of Mavscript with the computer-algebra-system Yacas shows to be favourable.
The disadvantage compared to a spread sheet application is less interactivity, especially when using graphs that depend on the results.

Installation


Disclaimer