arb4j is a robust Java API designed to efficiently represent mathematical structures in their most general forms, prioritizing high performance. It seamlessly integrates with the arblib library via an interface generated by SWIG, enabling arbitrary precision real and complex ball arithmetic operations.
'this'
if not specified.Example:
Real x = new Real("25", 128); // 128 bits of precision
// Both lines achieve the same result:
Real five = x.sqrt(128);
Real five = x.sqrt(128, x); // Using 'this' as the result variable explicitly
Real five = x.sqrt(128, new Real());
Real y = new Real("25", 128)
.add(RealConstants.one, 128)
.log(128)
.tanh(128);
AutoCloseable
interface is used for memory management.Example:
try (Real x = new Real("25", 128)) {
doSomething(x);
} // x is automatically closed, ensuring proper resource management
The following is the unmodified decompiled class file generated for the Type1ChebyshevPolynomial implementation
import arb.Integer;
import arb.RealPolynomial;
import arb.functions.Function;
public class T implements Function<Integer, RealPolynomial> {
private boolean isInitialized;
Integer c1 = new Integer("0");
Integer c2 = new Integer("1");
Integer c3 = new Integer("2");
public RealPolynomial r̅1 = new RealPolynomial();
public Integer ℤ1 = new Integer();
public RealPolynomial r̅2 = new RealPolynomial();
public RealPolynomial r̅3 = new RealPolynomial();
public Integer ℤ2 = new Integer();
public RealPolynomial r̅4 = new RealPolynomial();
public T T;
public RealPolynomial evaluate(Integer in, int order, int bits, RealPolynomial result) {
if (!isInitialized) {
initialize();
}
return switch(in.getSignedValue()) {
case 0 -> result.set(c2);
case 1 -> result.set(result.identity());
default -> c3
.mul(result.identity(), bits, r̅1)
.mul(T.evaluate(in.sub(c2, bits, ℤ1), order, bits, r̅2), bits, r̅3)
.sub(T.evaluate(in.sub(c3, bits, ℤ2), order, bits, r̅4), bits, result);
};
}
public void initialize() {
if (isInitialized) {
throw new AssertionError("Already initialized");
} else {
T = new T();
isInitialized = true;
}
}
public void close() {
c1.close();
c2.close();
c3.close();
r̅1.close();
ℤ1.close();
r̅2.close();
r̅3.close();
ℤ2.close();
r̅4.close();
T.close();
}
}
See this for a version of jlatexmath without the unnamed module warnings
arb4j is made available under the terms of the Business Source License™ v1.1 which can be found in the root directory of this project in a file named License.pdf, License.txt, or License.tm which are the pdf, text, and TeXmacs format of the same document respectively.