Loading repository data…
Loading repository data…
blacknoize404 / repository
MathUtils permite la computación matemática a través expresiones algebraicas como objetos de primera clase y árboles de expresión evaluables.
This library was born as a study project to link university mathematics coursework with infrastructure programming.
Why study math and programming separately when you can unify them?
MathUtils solves a concrete challenge: connecting advanced calculus and linear algebra with modular software development. It enables mathematical computation through algebraic expressions as first-class objects and evaluable expression trees.
In Java, traditional math is evaluated statically. You provide values, the environment executes the operation, and returns a numeric result. This works for simple operations. The traditional approach completely limits deep algebraic manipulation.
Equations need a hierarchical structure. Algebraic expressions must be first-class objects. MathUtils is the answer to that technical challenge.
Spanish documentation: README.md
You build complex mathematical formulas by chaining methods on the Function class. Your development completely avoids external string chains prone to syntax errors.
Var x = new Var("x");
Function f = new Function(x).sin().pow(2).mult(3).add(new Cos(x)); // 3·sin²(x) + cos(x)
double y = f.eval(new Evaluation("x", Math.PI)); // → 3·0 + (-1) = -1
Evaluation record.equalsTo): two trees are equal if they share exactly the same shape and operands. The system surpasses traditional numeric comparison.SumOperator and MultOperator accept multiple operands without artificial binary chaining.The library exposes production-ready components: Const, Var, Sin, Cos, Tan, Cot, Log, LogN, Sqrt, Cbrt, Root, Pow, Fraction — each is a MathElement and composes with operators.
Generic inheritance Vector<V extends Vector<V>> with:
Modules Point2D, Point3D, Line2D, Line3D, Plane, Space, and Curve perform absolute distance, intersection, and spatial projection calculations.
Factorial and Combinatory (binomial and multinomial models).WeightedMean.Progression management via Serie, Sequence. Contains numerical base conversion utilities and angle management (Angle in degrees, radians, and gradians).
mvn compile
mvn test
Var x = new Var("x");
Var y = new Var("y");
// Hierarchical tree construction: (x · y + sin(x)) / 2
Function f = new Function(x).mult(y).add(new Sin(x)).div(new Const(2));
// Evaluation with immutable variable passing
double r = f.eval(new Evaluation("x", 1.0), new Evaluation("y", 4.0));
// r ≈ 2.4207
src/main/java/MathUtils/
├── algebra/
│ ├── primitives/ # MathElement, Expression, Operator (base)
│ ├── operators/ # Sum, Sub, Mult, Div (n-ary)
│ ├── trigonometrics/ # Sin, Cos, Tan, Cot
│ ├── exponentials/ # Pow, Root, Sqrt, Cbrt
│ ├── logarithmics/ # Log, LogN
│ ├── Const.java
│ ├── Var.java
│ ├── Function.java # Fluent chaining + eval(Evaluation...)
│ └── Evaluation.java # record(var, value)
├── vector/ # Vector, Vector2D, Vector3D
├── point/ # Point, Point2D, Point3D
├── line/ # Line, Line2D, Line3D, Plane, Space, Curve
├── combinatory/ # Factorial, Combinatory
├── statistics/ # WeightedMean
├── series/ # Serie
├── sequences/ # Sequence
├── informatics/ # Conversions
├── Angle.java
└── exceptions/
These topics are planned but not implemented. See
TODO.mdfor details.
Function objects and clean LaTeX export.Contributions are welcome:
This project is distributed under the CC-BY-NC-SA 4.0 license. Your academic use keeps the code open and accessible to the scientific community.