Skip to content
Axel Kramer edited this page Nov 6, 2021 · 19 revisions

Symja can be used as computer algebra system in a REPL featuring Mathematica-compatible syntax and functions.

Installation

Make sure that a Java 11 runtime environment (JRE 11) is installed. At a terminal you can type java -version to see if it is installed.

Download the latest Symja release from

Unzip the download in a separate folder and modify the symjamma.bat file to use your Java 8 installation path to run the Symja MMAConsole:

"%JAVA_HOME%\bin\java" -classpath "lib/*" org.matheclipse.io.eval.MMAConsole  

Maven

Alternatively, if you're using Maven you can run this Maven command:

mvn -f pom.xml exec:java@mma -pl matheclipse-io

Usage

The available predefined function names in the console are described in the

You can load a package with the Get[] function like this:

Get["./data/test.m"]

and call for example the f[] or g[] functions defined in test.m:

>> f[2]
In[2]:= f[2]
Out[2]= 4
>> g[3]
In[3]:= g[3]
Out[3]= 81
>> 

Other examples for using or programming packages can be found here

There are additional arguments to run MMAConsole and get the result back to the caller

  • -c or -code run the command
  • -f or -function -args arg1 arg2 run the function

Examples

>> 24/60
2/5

>> N[24/60]
0.4

>> Sin[30*Degree]
1/2

>> Sin[Pi/2]
1

>> a+a+4*b^2+3*b^2
2*a+7*b^2

>> Solve[{x^2-11==y, x+y==-9}, {x,y}]
{{x->-2,y->-7},{x->1,y->-10}}

>> DSolve[{y'[x]==y[x]+2,y[0]==1},y[x], x]
{{y[x]->-2+3*E^x}}

>> Integrate[Cos[x]^5, x]
Sin[x]-2/3*Sin[x]^3+Sin[x]^5/5

>> D[Sin[x]^3,x]
3*Cos[x]*Sin[x]^2

>> Factor[-1+x^16]
(-1+x)*(1+x)*(1+x^2)*(1+x^4)*(1+x^8)

>> Factor[5+x^12, Modulus->7]
(2+x^3)*(5+x^3)*(4+x^6)

>> Expand[(-1+x)*(1+x)*(1+x^2)*(1+x^4)*(1+x^8)]
-1+x^16

>> Det[{{1,2},{3,4}}]
-2

>> Inverse[{{1,2},{3,4}}]
{{-2,1},
 {3/2,-1/2}}

>> FactorInteger[2^15-5]
{{3,1},{67,1},{163,1}}

>> Refine[Abs[n*Abs[m]], n<0]
-n*Abs[m]