Class AlgebraicUtils

java.lang.Object
software.bluelib.utils.math.AlgebraicUtils

public class AlgebraicUtils extends Object
A class providing methods for various algebraic and combinatorial calculations.

Key Methods:

Since:
1.0.0
  • Method Details

    • solveQuadraticEquation

      public static double[] solveQuadraticEquation(double pA, double pB, double pC)
      A Double[] that solves the quadratic equation ax^2 + bx + c = 0 using the quadratic formula.
      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)
      A Long that calculates the factorial of a non-negative integer.
      Parameters:
      pNumber - Integer - The non-negative integer.
      Returns:
      The factorial of the integer.
      Throws:
      IllegalArgumentException - if pNumber is negative.
      Since:
      1.0.0
    • calculateGCD

      public static int calculateGCD(int pA, int pB)
      A Integer that calculates the greatest common divisor of two integers using the Euclidean algorithm.
      Parameters:
      pA - Integer - The first integer.
      pB - Integer - The second integer.
      Returns:
      The greatest common divisor of pA and pB.
      Since:
      1.0.0
    • generatePowerSet

      public static <T> List<Set<T>> generatePowerSet(Set<T> pSet)
      A List<Set> that generates the power set (all subsets) of a given set.
      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