GetYacasPID , ShowPS , MakeFunctionPlugin , Version , Vi .

Platform-dependent packages

Certain facilities have been developed for use on the Unix platform, which is currently the main development platform for Yacas. These packages are described in this chapter.

GetYacasPID obtain Yacas process number
ShowPS view equations graphically
MakeFunctionPlugin compile numerical functions into plugins
Version show version of Yacas
Vi edit a file or function


GetYacasPID -- obtain Yacas process number

Unix-specific add-on
Calling format:
GetYacasPID()

Description:
Returns an integer containing the process number (PID) of the Yacas session.

Requires: a Unix shell.

Example:
In> GetYacasPID()
Out> 26456;

See also:
SystemCall .


ShowPS -- view equations graphically

Unix-specific add-on
Calling format:
ShowPS(expr)

Parameters:
expr -- any expression (not evaluated)

Description:
Exports a Yacas expression to LaTeX, generates a Postscript file and shows it in a viewer. The free viewer gv must be available on the Unix shell path. An alternative viewer can be specified by assigning to the global variable PSViewCommand.

Requires: a Unix shell, latex, dvips, gv or another Postscript viewer.

Example:
In> [ PSViewCommand := "ghostview"; \
  ShowPS(x+2*Sin(x)); ]
Expression exported as /tmp/yacas-tmp
file-28802.tex
Out> True;

See also:
TeXForm .


MakeFunctionPlugin -- compile numerical functions into plugins

Unix-specific add-on
Calling format:
MakeFunctionPlugin("name", body)

Parameters:
"name" -- string, name of a new function

body -- expression, function of arguments, must evaluate to a function of some variables.

Description:
Compiles an external plugin library that computes a user-defined numerical function and dynamically loads it into Yacas, enabling a new function called "name".

Requires: a Unix shell, a compiler named c++ with ELF .so support, Yacas headers in FindFile("")/include; current directory must be writable.

The body expression must be a CForm()-exportable function of the arguments and may contain numerical constants. Pi is allowed and will be converted to floating-point.

All arguments and the return value of the function are assumed to be double precision real numbers. The result of passing a non-numerical argument will be an unevaluated expression.

Example:

In> MakeFunctionPlugin("f1", {x,y}, Sin(x/y))
Function f1(x,y) loaded from
plugins.tmp/libf1_plugin_cc.so
Out> True;
In> f1(2,3)
Out> 0.618369803069736989620253;
In> f1(x,5)
Out> f1(x,5);

The function creates the following files in subdirectory plugins.tmp/ of current directory:

After creating these files, MakeFunctionPlugin() will:

If you call MakeFunctionPlugin() repeatedly to define a function with the same name, old files will be overwritten and old libraries will be unloaded with DllUnload().

See also:
DllLoad , DllUnload , DllEnumerate , CForm .


Version -- show version of Yacas

Internal function
Calling format:
Version()

Description:
The function Version() returns a string representing the version of the currently running Yacas interpreter.

Examples:
In> Version()
Out> "1.0.48rev3";
In> LessThan(Version(), "1.0.47")
Out> False;
In> GreaterThan(Version(), "1.0.47")
Out> True;

The last two calls show that the LessThan and GreaterThan functions can be used for comparing version numbers. This method is only guaranteed, however, if the version is always expressed in the form d.d.dd as above.

See also:
LessThan , GreaterThan .


Vi -- edit a file or function

Unix-specific add-on
Calling format:
Vi(filename);
Vi(functionname);

Parameters:
filename - name of a file to edit

functionname - name of a function to find for editing

Description:
Vi will try to edit a file, or if the argument passed is a function, it will try to edit the file the function is defined in. It will try to do so by invoking the editor vi.

It finds the function by scanning the *.def files that have been reported to the system. (Vi calls FindFunction for this.) If editing a function, the command will jump directly to the first occurrence of the name of the function in the file (usually the beginning of a definition of a function).

For Vi() to be really useful, you need to start Yacas from the scripts/ directory in the development tree. In that case, FindFunction() will return the filename under that directory. Otherwise, FindFunction() will return a name in the systemwide installation directory (or directory specified in the --rootdir option).

Examples:
In> Vi("yacasinit.ys")
Out> True;
In> Vi("Sum")
Out> True;

See also:
FindFunction .