Package software.bluelib.utils.math
Class AlgebraicUtils
java.lang.Object
software.bluelib.utils.math.AlgebraicUtils
A
class providing methods for various algebraic and combinatorial calculations.
Key Methods:
solveQuadraticEquation(double, double, double)- Solves a quadratic equation.factorial(int)- Calculates the factorial of a non-negative integer.calculateGCD(int, int)- Calculates the greatest common divisor of two integers.generatePowerSet(Set)- Generates the power set of a given set.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateGCD(int pA, int pB) AIntegerthat calculates the greatest common divisor of two integers using the Euclidean algorithm.static longfactorial(int pNumber) ALongthat calculates the factorial of a non-negative integer.generatePowerSet(Set<T> pSet) static double[]solveQuadraticEquation(double pA, double pB, double pC)
-
Method Details
-
solveQuadraticEquation
public static double[] solveQuadraticEquation(double pA, double pB, double pC) - Parameters:
pA-Double- The coefficient a of the quadratic equation.pB-Double- The coefficient b of the quadratic equation.pC-Double- The coefficient c of the quadratic equation.- Returns:
- An array of roots of the quadratic equation. The array may be empty if there are no real roots.
- Since:
- 1.0.0
-
factorial
public static long factorial(int pNumber) ALongthat calculates the factorial of a non-negative integer.- Parameters:
pNumber-Integer- The non-negative integer.- Returns:
- The factorial of the integer.
- Throws:
IllegalArgumentException- ifpNumberis negative.- Since:
- 1.0.0
-
calculateGCD
public static int calculateGCD(int pA, int pB) AIntegerthat calculates the greatest common divisor of two integers using the Euclidean algorithm. -
generatePowerSet
- Type Parameters:
T- The type of elements in the set.- Parameters:
pSet-Set<T>- The input set.- Returns:
- A list of all subsets of the input set.
- Since:
- 1.0.0
-