readme.md

September 12, 2026 ยท View on GitHub

Symja Library - Java Symbolic Math System for Android calculator

Join our Discord Symja Maven Central

Build Master Snapshot Sonatype Nexus (Snapshots)

Note: this repository contains the Java 11 sources of the core modules. A minimal Android app example can be found in the symja-example repository :

Try the full-blown Android or iOS apps:

or help testing the latest Android BETA version or the web demo at matheclipse.org.

Read the Symja Manual :blue_book: for the description of the Symja language or browse the available functions :green_book: . We encourage everyone to participate in our Wiki.

๐Ÿ”ง Installation

The different kinds of installations are described in the Wiki Installation.

โœจ Features

Features of the Symja language:

๐Ÿ“ฆ Applications

โ˜• Examples

Console user interface

HTML notebook interface

To get an idea of the kinds of expressions Symja handles, see the JUnit tests in this file.

Web Examples

Solve({x^2==4,x+y^2==6}, {x,y})

FactorInteger(2152^{15}-5)

D(Sin(x^3), x)

Factor(-1+x^16)

Manipulate(Plot3D(Sin(a * x * y), {x, -1.5, 1.5}, {y, -1.5, 1.5}), {a,1,5})

Plot(Piecewise({{x^2, x < 0}, {x, x >= 0&&x<1},{Cos(x-1), x >= 1}}), {x, -2, 12})

Refine(Abs(n*Abs(m)),n<0)

Inverse({{1,2},{3,4}})

Det({{1,2},{3,4}})

Integrate(Cos(x)^5, x)

JavaForm((x+1)^2+(x+1)^3, Float)

ToExpression("\\frac{x}{\\sqrt{5}}", TeXForm)

A Java usage example:

package org.matheclipse.core.examples;

import org.matheclipse.core.eval.ExprEvaluator;
import org.matheclipse.core.expression.F;
import org.matheclipse.core.interfaces.IAST;
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.core.interfaces.ISymbol;
import org.matheclipse.parser.client.SyntaxError;
import org.matheclipse.parser.client.math.MathException;

public class Example {
  public static void main(String[] args) {
    try {
      ExprEvaluator util = new ExprEvaluator(false, (short) 100);

      // Convert an expression to the internal Java form:
      // Note: single character identifiers are case sensitive
      // (the "D()" function identifier must be written as upper case
      // character)
      String javaForm = util.toJavaForm("D(sin(x)*cos(x),x)");
      // prints: D(Times(Sin(x),Cos(x)),x)
      System.out.println("Out[1]: " + javaForm.toString());

      // Use the Java form to create an expression with F.* static
      // methods:
      ISymbol x = F.Dummy("x");
      IAST function = F.D(F.Times(F.Sin(x), F.Cos(x)), x);
      IExpr result = util.eval(function);
      // print: Cos(x)^2-Sin(x)^2
      System.out.println("Out[2]: " + result.toString());

      // Note "diff" is an alias for the "D" function
      result = util.eval("diff(sin(x)*cos(x),x)");
      // print: Cos(x)^2-Sin(x)^2
      System.out.println("Out[3]: " + result.toString());

      // evaluate the last result (% or $ans contains "last answer")
      result = util.eval("%+cos(x)^2");
      // print: 2*Cos(x)^2-Sin(x)^2
      System.out.println("Out[4]: " + result.toString());

      // evaluate an Integrate[] expression
      result = util.eval("integrate(sin(x)^5,x)");
      // print: 2/3*Cos(x)^3-1/5*Cos(x)^5-Cos(x)
      System.out.println("Out[5]: " + result.toString());

      // set the value of a variable "a" to 10
      // Note: in server mode the variable name must have a preceding '$'
      // character
      result = util.eval("a=10");
      // print: 10
      System.out.println("Out[6]: " + result.toString());

      // do a calculation with variable "a"
      result = util.eval("a*3+b");
      // print: 30+b
      System.out.println("Out[7]: " + result.toString());

      // Do a calculation in "numeric mode" with the N() function
      // Note: single character identifiers are case sensistive
      // (the "N()" function identifier must be written as upper case
      // character)
      result = util.eval("N(sinh(5))");
      // print: 74.20321057778875
      System.out.println("Out[8]: " + result.toString());

      // define a function with a recursive factorial function definition.
      // Note: fac(0) is the stop condition.
      result = util.eval("fac(x_Integer):=x*fac(x-1);fac(0)=1");
      // now calculate factorial of 10:
      result = util.eval("fac(10)");
      // print: 3628800
      System.out.println("Out[9]: " + result.toString());

      function =
          F.Function(F.Divide(F.Gamma(F.Plus(F.C1, F.Slot1)), F.Gamma(F.Plus(F.C1, F.Slot2))));
      // eval function ( Gamma(1+#1)/Gamma(1+#2) ) & [23,20]
      result = util.evalFunction(function, "23", "20");
      // print: 10626
      System.out.println("Out[10]: " + result.toString());
    } catch (SyntaxError e) {
      // catch Symja parser errors here
      System.out.println(e.getMessage());
    } catch (MathException me) {
      // catch Symja math errors here
      System.out.println(me.getMessage());
    } catch (final Exception ex) {
      System.out.println(ex.getMessage());
    } catch (final StackOverflowError soe) {
      System.out.println(soe.getMessage());
    } catch (final OutOfMemoryError oome) {
      System.out.println(oome.getMessage());
    }
    }
}

๐Ÿ”จ Maven Usage

How to use Maven is described in the Maven wiki page.

Getting started

First, you'll need a Java Development Kit (JDK) compatible with Java 11 or later.

The Integrated Development Environment (IDE) Eclipse is shipped with a suitable JDK, so you don't have to install a JDK by yourself. Install and open the latest version of the Eclipse development IDE for Java Developers:

Github GIT

a) Fork the Symja repository to use as a starting point.

  • Navigate to github.com/axkr/symja_android_library in your browser.
  • Click the "Fork" button in the top-right of the page.
  • Once your fork is ready, open the new repository's "Settings" by clicking the link in the menu bar on the left.
  • Change the repository name to the name of your Library and save your changes.

b) Clone your new repository to your Eclipse workspace.

  • Open Eclipse and select the "File -> Import..." menu item.
  • Select "Git -> Projects from Git", and click "Next >".
  • Select "URI" and click "Next >".
  • Enter your repository's clone URL in the "URI" field. The remaining fields in the "Location" and "Connection" groups will get automatically filled in.
  • Enter your Github credentials in the "Authentication" group, and click "Next >".
  • Select the master branch on the next screen, and click "Next >".
  • The default settings on the "Local Configuration" screen should work fine, click "Next >".
  • Make sure "Import existing projects" is selected, and click "Next >".
  • Eclipse should find and select the symja_android_library automatically, click "Finish".

See this Git version control with Eclipse (EGit) - Tutorial for a general overview.

Contact

If you have any questions about using or developing for this project, send me an email!

License

  • the complete Symja system is published under the GNU GENERAL PUBLIC LICENSE Version 3 (GPL) starting with Symja version 2.0.0 parts are published under the Lesser GNU GENERAL PUBLIC LICENSE Version 3 (LGPL).

If you would like to use parts of the system here are some Maven module licenses:

  • the maven modules: parser, external, core are published under LGPL license.
  • the maven modules: gpl, api, io are published under GPL license.

Here are some of the associated JavaScript licenses:

Science and math library dependencies by Maven module

The Maven modules below all build on matheclipse-core. A module inherits the dependencies of every module it depends on, so the licenses of matheclipse-core apply everywhere. matheclipse-core itself depends on matheclipse-parser and matheclipse-external; the third-party code vendored inside matheclipse-external is therefore listed together with core.

matheclipse-core

ProjectPurposeLicense
Hipparchuslinear algebra, ODE solvers, optimization, statistics, FFT, geometry, clustering, curve fittingApache License 2.0
apfloatarbitrary precision arithmeticMIT License
LogicNGboolean logic, SAT solvingApache License 2.0
Choco-solverconstraint programmingBSD 3-Clause License
AdaptiveQuadratureadaptive Gauss-Kronrod numerical integrationApache License 2.0
RoaringBitmapcompressed bitsetsApache License 2.0
MFLMATLAB .mat file import and exportApache License 2.0
Paguropersistent (immutable) collectionsApache License 2.0 or EPL 1.0
JAS Java Algebra System (vendored in matheclipse-external)polynomial arithmetic, factorization, Groebner basesLGPL; the Java bytecode is dual licensed under Apache 2.0 to allow usage in Android projects
Cream (vendored in matheclipse-external)finite domain constraint solvingLGPL
Diophantine (vendored in matheclipse-external)solving Diophantine equationsMIT License
SnuggleTeX (vendored in matheclipse-external)LaTeX to MathML conversionBSD License
fastutil (slim fork vendored in matheclipse-external)primitive type collectionsApache License 2.0

matheclipse-gpl

ProjectPurposeLicense
java-math-library (vendored as de.tilman_neumann.jml)integer factorization, prime numbers, partitions, modular arithmetic, quadratic residuesGNU GPL v3

This module is the reason a distribution containing it has to be published under the GPL.

matheclipse-graphtheory

ProjectPurposeLicense
JGraphTgraph data structures and graph algorithmsEPL 2.0 or LGPL 2.1

matheclipse-image

ProjectPurposeLicense
BoofCVimage processing and computer visionApache License 2.0
Hipparchusnumerics and statistics for image operationsApache License 2.0
JSVGSVG renderingMIT License
TwelveMonkeys ImageIOadditional raster image formats (JPEG, BMP, TIFF, WebP, PNM)BSD 3-Clause License

matheclipse-astro

ProjectPurposeLicense
Orekitastronomy and space flight dynamicsApache License 2.0
Hipparchuslinear algebra and geometryApache License 2.0

matheclipse-bio

ProjectPurposeLicense
BioJavabioinformatics, sequence alignment, amino acid propertiesLGPL 2.1

matheclipse-chem

ProjectPurposeLicense
Chemistry Development Kit (CDK)chemoinformatics, molecular formulas, SMILES/SMARTS, structure diagramsLGPL 2.1 or later

matheclipse-nlp

ProjectPurposeLicense
ICU4JUnicode, locale, transliteration and unit dataUnicode License v3

matheclipse-dataset

ProjectPurposeLicense
Tablesaw (vendored fork)dataframes and table operationsApache License 2.0
Apache Arrowcolumnar in-memory data formatApache License 2.0
Apache POIExcel import and exportApache License 2.0
fastutilprimitive type collectionsApache License 2.0
RoaringBitmapcompressed bitsetsApache License 2.0
ICU4Jlocale aware parsing and formattingUnicode License v3
jsoupHTML table importMIT License

matheclipse-compile

ProjectPurposeLicense
Janinoruntime Java compilerBSD 3-Clause License
JavaPoetJava source code generationApache License 2.0

matheclipse-script

ProjectPurposeLicense
apfloatarbitrary precision arithmeticMIT License

This module also depends on matheclipse-gpl and therefore inherits the GPL.

matheclipse-md2html

ProjectPurposeLicense
commonmark-javaMarkdown parsing and HTML renderingBSD 2-Clause License

matheclipse-discord

ProjectPurposeLicense
Discord4JDiscord bot clientLGPL 3.0

matheclipse-io

This module aggregates image, nlp, astro, gpl, bio, chem, graphtheory, compile and dataset and therefore inherits all libraries listed above. In addition it bundles the JavaScript libraries listed in the License section, including KaTeX for math typesetting.

<a href = https://github.com/axkr/symja_android_library/graphs/contributors> <img src = https://contrib.rocks/image?repo=axkr/symja_android_library>