There is colt.

The Colt library provides fundamental general-purpose data structures optimized for numerical data, such as resizable arrays, dense and sparse matrices (multi-dimensional arrays), linear algebra, associative containers and buffer management.

The Jet library contains mathematical and statistical tools for data analysis, powerful histogramming functionality, Random Number Generators and Distributions useful for (event) simulations, and more.

The CoreJava library contains C-like print formatting. The Concurrent library contains standardized, efficient utility classes commonly encountered in parallel & concurrent programming.

Answer from miku on Stack Overflow
๐ŸŒ
Oracle
docs.oracle.com โ€บ javase โ€บ 8 โ€บ docs โ€บ api โ€บ java โ€บ lang โ€บ Math.html
Math (Java Platform SE 8 )
October 20, 2025 - Javaโ„ข Platform Standard Ed. 8 ... The class Math contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions.
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_math.asp
Java Math
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... The Java Math class has many methods that allows you to perform mathematical tasks on numbers.
Discussions

What is the best math library to use with java? - Stack Overflow
The Concurrent library contains standardized, efficient utility classes commonly encountered in parallel & concurrent programming. ... Sign up to request clarification or add additional context in comments. ... Apache Commons Math might be helpful. So might JAMA. UPDATE: In the 2.5 years since I last answered this, I've become aware of Apache's Mahout and WEKA. Both are excellent Java ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
I need a Java library that simplifies math equations - Software Recommendations Stack Exchange
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... You can use the Symja - Java computer algebra and symbolic math library. More on softwarerecs.stackexchange.com
๐ŸŒ softwarerecs.stackexchange.com
java - Should I import a math library, and if so how? - Stack Overflow
I think I have to import the math library. ... E and PI are not functions, they're static fields (data members). That code will output their values correctly. You don't have to import anything, the Math class is in the java.lang package, which is imported by default. More on stackoverflow.com
๐ŸŒ stackoverflow.com
Java math libraries?
Apache Math has a polynomial fitter. It also has a linear solver and lots of other useful bits. I haven't used a symbolic math solver in Java. It's not quite the same, but I did use Z3 with Java this year, there is z3-turnkey that provides a helpful Maven dependency for that. More on reddit.com
๐ŸŒ r/adventofcode
4
8
December 26, 2023
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ java-math-class
Java Math Class - GeeksforGeeks
July 23, 2025 - System.out.println("The floor of " + x + " is " + Math.floor(x)); System.out.println("The floor of " + y + " is " + Math.floor(y)); // Comparison operators // min() returns the smaller of the two arguments // you pass it System.out.println("min(" + i + "," + j + ") is " + Math.min(i, j)); System.out.println("min(" + x + "," + y + ") is " + Math.min(x, y)); // There's a corresponding max() method // that returns the larger of two numbers System.out.println("max(" + i + "," + j + ") is " + Math.max(i, j)); System.out.println("max(" + x + "," + y + ") is " + Math.max(x, y)); // The Math library d
๐ŸŒ
W3Schools
w3schools.com โ€บ java โ€บ java_ref_math.asp
Java Math Reference
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Server Java Syllabus Java Study Plan Java Interview Q&A Java Certificate ... The Java Math class has many methods that allows you to perform mathematical tasks on numbers.
๐ŸŒ
Apache Commons
commons.apache.org โ€บ math
Math โ€“ Commons Math: The Apache Commons Mathematics Library
Commons Math is a library of lightweight, self-contained mathematics and statistics components addressing the most common problems not available in the Java programming language or Commons Lang ยท Download the Latest Release of Commons Math
Find elsewhere
๐ŸŒ
FavTutor
favtutor.com โ€บ blogs โ€บ java-math-class
Math Class in Java & Methods (with Examples)
October 9, 2023 - When it comes to performing mathematical operations in Java, you have the option to use the built-in Math class or third-party libraries specifically designed for mathematical computation, such as Apache Commons Math or JAMA.
Top answer
1 of 3
1

You can use the Symja - Java computer algebra and symbolic math library.

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;

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("4*x + x - 20 + 10");
      // prints: Plus(ZZ(-20L),x,Times(C4,x),C10)
      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.Plus(F.ZZ(-20L), x, F.Times(F.C4, x), F.C10);
      IExpr result = util.eval(function);
      // print: -10+5*x
      System.out.println("Out[2]: " + result.toString());
    } catch (SyntaxError e) {
      // catch Symja parser errors here
      System.out.println(e.getMessage());
    } catch (RuntimeException rex) { 
      System.out.println(rex.getMessage());
    }
  }
}
2 of 3
0

DataMelt (http://jwork.org/dmelt) does this. Here is an example (I use Jython, but you can use Java too)

from jhplot.math import *  
from jhplot import *
j=Symbolic("jscl") # using jscl engine
print j.simplify("(x + 1)^(1/x)") == "(1+x)^(1/x)" 
print j.simplify("(x^2-1)/(x-1)") == "1+x"

This code returns "true" for all such simplifications

๐ŸŒ
GitHub
github.com โ€บ TilmanNeumann โ€บ java-math-library
GitHub - TilmanNeumann/java-math-library: A Java math library focused on number theory and integer factorization in particular.
A Java math library focused on number theory and integer factorization in particular. - TilmanNeumann/java-math-library
Starred by 33 users
Forked by 8 users
Languages ย  Java 100.0% | Java 100.0%
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ java โ€บ java_lang_math.htm
Java - Math Class
The java.lang.Math class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. Following is the declaration for java.lang.Math class โˆ’ Following are the
๐ŸŒ
Quora
quora.com โ€บ How-do-I-import-a-math-class-in-Java
How to import a math class in Java - Quora
Use for arbitrary-precision integer and decimal arithmetic. ... Java provides math-related functionality through the java.lang.Math and java.math packages.
๐ŸŒ
Jenkov
jenkov.com โ€บ tutorials โ€บ java โ€บ math-operators-and-math-class.html
Java Math Operators and Math Class
Java contains a set of built-in math operators for performing simple math operations on Java variables. The Java math operators are reasonably simple. Therefore Java also contains the Java Math class which contains methods for performing more ...
๐ŸŒ
Medium
medium.com โ€บ @AlexanderObregon โ€บ beginners-guide-to-java-math-21edc9cc1ee0
Java Math Guide for Beginners | Medium
March 9, 2024 - As we go deeper into Javaโ€™s mathematical capabilities, we encounter the Math classโ€”a powerful library that Java offers for performing a wide array of mathematical operations beyond basic arithmetic.
๐ŸŒ
Tutorial Gateway
tutorialgateway.org โ€บ java-math-library
Java Math Library
March 28, 2025 - The Java Math Library provides various Functions and Constants / Properties. These math functions allow us to perform basic mathematical operations like square root, cube root, logarithmic, and trigonometric functions. Unlike other global objects, Properties, and Functions inside the Java math ...
๐ŸŒ
Java Almanac
javaalmanac.io โ€บ jdk โ€บ 1.2 โ€บ api โ€บ java โ€บ lang โ€บ Math.html
Java Platform 1.2 API Specification: Class Math
To help ensure portability of Java ... algorithms. These algorithms are available from the well-known network library netlib as the package "Freely Distributable Math Library" (fdlibm)....
๐ŸŒ
Reddit
reddit.com โ€บ r/adventofcode โ€บ java math libraries?
r/adventofcode on Reddit: Java math libraries?
December 26, 2023 -

One thing I learned this year is that maybe I should figure out how to use some math libraries/packages.

There are two problems that I ended up using a little outside help with. One was doing a polyfit. Especially, I have a list of input values and output results and I want the computer to tell me a function that matches. This is good for things where I'm sure there is a simple math relation, I just can't see it. For example in one problem, I had a series of numbers and needed polyfit to tell me I was actually looking at 5 + 2x + x^2 or something like that.

I ended up using python and numpy for that, which worked but I'd like to add that sort of capability to my Java tool kit.

The other, I kinda worked around but it would be nice to have is a symbolic math solver.

I've poked at Symja which has a enticing named solver:
https://bitbucket.org/axelclk/symja_android_library/wiki/Solve

But I'm having trouble getting the dependencies to run. Anyone have anything they like?

In case it matters, I'm using bazel to build, which means I can easily include anything that is on maven.

๐ŸŒ
Maven Repository
mvnrepository.com โ€บ open-source โ€บ math-libraries
Maven Repository: Math Libraries
Alternate implementations of JDK's "Math" functions. ... A fast and easy to use dense and sparse matrix linear algebra library written in Java.
๐ŸŒ
jmathanim
davidgutierrezrubio.github.io โ€บ jmathanim
jmathanim | A Java library to make mathematical animations
JMathAnim is a library written in JAVA to simplify the process of creating mathematical animations. mathematical animations.