mavscript

Copyright (c) A.Vontobel, 2004 - 2016

With Mavscript you can do calculations in a text document.

The following file formats are supported:
File format with limited support:

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:


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 a computer-algebra-system, such a 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

see How to install

Usage

STANDARD

If Mavscript has been installed as described and the included algebra program yacas is used:
  1. Create a template (input) file: template.txt, template.html 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. When finished, check if there is an error message and close the window.
  4. Open the output file (out-template.txt, out-template.html or out-template.odt) .

ALTERNATE (in order to use advanced functions or if the standard procedure does not work)

Mavscript alternately can be called out of the shell (command prompt, konsole, terminal).
cd path-to-mavscript and then:

ENHANCED FUNCTIONS

Mavscript can also be connected to stdin and stdout pipes:
cat inputfile | mavscript-yacas > outputfile   or
echo '§m nf(Pi*8^2,1) §io' | mavscript-yacas   (answering "nf(Pi*8^2,1) --> 201.1")

Disclaimer