Class Utilities

java.lang.Object
math.differentialcalculus.Utilities

public class Utilities extends Object
  • Field Details

    • whitespaceremover

      public static final ArrayList<String> whitespaceremover
  • Constructor Details

    • Utilities

      public Utilities()
  • Method Details

    • freeSpaces

      public static void freeSpaces(List<String> scan)
    • print

      public static void print(Object obj)
    • isAutoGenNameFormat

      public static boolean isAutoGenNameFormat(String name)
      Parameters:
      name - The name to check.
      Returns:
      true if the name is automatically generated and so, most likely refers to a stored Differentiable.
    • getText

      public static String getText(ArrayList<String> data)
      Parameters:
      data - An ArrayList of Strings. return the Strings in the List concatenated together.
    • isDifferentiable

      public static boolean isDifferentiable(String value)
      Parameters:
      value - The item to check Always double check in the scanner where this item exists that the next token to value is not an open bracket if value is a valid variable name.
      Returns:
      true if it can be differentiated to get a value.
    • isFormula

      public static boolean isFormula(String name)
    • simplifyNegOneProducts

      public static void simplifyNegOneProducts(ArrayList<String> list)
      Simplifies portions of math code that involve products or quotients of -1.
      Parameters:
      list - The list of math tokens.
    • simplifyZeroes

      public static void simplifyZeroes(ArrayList<String> array)
      Parameters:
      array - The scanned list containing math tokens. This method seeks to apply the algebraic effect of adding or subtracting or multiplying zeroes to a math expression. e.g. 3*x*0+4*1 becomes 4*1.
    • simplifyZeroesAt

      public static void simplifyZeroesAt(int index, ArrayList<String> list)
      Parameters:
      index - The index at which the zero is.
      list - The scanned list containing math tokens. Method that recursively applies the effect of zero at its point of occurrence to a math expression.
    • simplifyOneProducts

      private static void simplifyOneProducts(int index, ArrayList<String> list)
      Parameters:
      index - The index of the 1
      list - The ArrayList containing it. Seeks to calculate the effect of multiplying 1 with quantities in the list...e.g 1*(....) becomes (.....), 1*sin(...) becomes sin(...)
    • simplifyOneProducts

      public static void simplifyOneProducts(ArrayList<String> list)
      Parameters:
      list - The ArrayList containing it. Seeks to calculate the effect of multiplying 1 with quantities in the list...e.g 1*(....) becomes (.....), 1*sin(...) becomes sin(...)
    • openBrackets

      public void openBrackets(ArrayList<String> scan)
      Checks for the pattern.. ...+,(,.......,)+|- and removes the bracket..if possible.
      Parameters:
      scan - The list of math tokens
    • evaluateTokens

      public static void evaluateTokens(ArrayList<String> scan)
      Evaluates products of numbers or divisions of numbers.
      Parameters:
      scan - The scanner output.
    • tokenRearranger

      public static void tokenRearranger(ArrayList<String> scan)
      Condenses numbers and variables to be added within a bracket to the end of the bracket. For instance,(3+x+sin(3*x)+5-7) becomes (sin(3*x)+3+x-2)
      Parameters:
      scan - The scanner output.
    • multipleBracketRemover

      public static void multipleBracketRemover(ArrayList<String> list)
      Parameters:
      list - The list containing the scanned math tokens.
    • multipleBracketRemover_

      public static void multipleBracketRemover_(ArrayList<String> list)
      Parameters:
      list - The list containing the scanned math tokens.
    • main

      public static void main(String[] s)