ApCoCoA-1:HowTo:Run ApCoCoA on a Computing Server
This HowTo shows you how to run ApCoCoA on a Linux server at terminal.
- Download ApCoCoA QT and unzip the file. This HowTo will take ApCoCoA 1.9.0 as an example.
wget http://www.apcocoa.org/download/apcocoa/linux-x86_64/apcocoa-1.9.0-QT-linux-x86_64.tgz tar xzvf apcocoa-1.9.0-QT-linux-x86_64.tgz
- Recommend to use a tool like "screen" (http://www.gnu.org/software/screen/screen.html) or "tmux" (http://tmux.sourceforge.net/) which allows you to run apcocoa(server) in the background, so that you can log off from the terminal session without having to stop the program.
ApCoCoA with Text Interface
Go to the folder ApCoCoA-1.9.0. The contents in the folder are as follows. In the following, assume that you are working at the directory ApCoCoA-1.9.0/.
Run the following command at terminal to start the ApCoCoA text interface.
You can run any (Ap)CoCoA command in this interface.
In many cases you also need to run the ApCoCoAServer. Here, assume that you have some terminal tools, like "screen", "tmux", etc., to create new terminal sessions, and that you are able to switch between terminal sessions without having to stop the running program.
Create a new terminal session for the ApCoCoAServer and run the following command to start the ApCoCoAServer.
Observe that the ApCoCoAServer is running on the default port 49344 (0xc0c0). You can run the ApCoCoAServer on another port n by using option -p as follows.
./ApCoCoAServer -p n
Now let us switch to the terminal session for the ApCoCoA text interface again. Execute the following commands.
X:="xy"; M:=["xxx","yxy","xyx"]; NCo.IsFinite(X, M); -- Check whether <x,y>/<x^3,yxy,xyx> is finite
The function NCo.IsFinite uses the ApCoCoAServer. You will get the following result in the ApCoCoA text interface.
And you can see the following message in the terminal session for the ApCoCoAServer.
ApCoCoA Program Files
Sometimes it is useful to write commands or functions in ApCoCoA program files. For example, we define a function for computing Fibonacci numbers as follows.
Define Fib(N) If N<=1 Then Return 0; Elif N=2 Then Return 1; Else Return Fib(N-2)+Fib(N-1); EndIf; EndDefine;
In order to load this function to ApCoCoA, we write the function in an ApCoCoA program file, say test.coc, in the directory ApCoCoA-1.9.0/. Then, using the following command, we run ApCoCoA which processes the file test.coc as a batch file. Then, we can use the function Fib(N) to compute Fibonacci numbers in ApCoCoA.