PiMath API
    Preparing search index...

    Class PolyFactor

    A polynomial expression in factored form: a list of Factors whose product is the value. A factor with a negative power belongs to the denominator. Built from a string ("(x-1)(x+2)^2", "(x+1)/(x-2)"), a polynom or factors. Operations modify the object and return it; clone() keeps the original.

    new PolyFactor("(x-1)(x+2)^2").develop().display // "x^(3)+3x^(2)-4"
    

    Implements

    Index
    • get asPower(): this

      Display option (default): the factors are written one after the other, with their exponent. Chainable, kept by clone.

      Returns this

    • get asRoot(): this

      Display option: the factors with a negative power are written in a fraction under the numerator. Chainable, kept by clone.

      Returns this

    • get roots(): Solution[]

      Roots of every factor, sorted by value without duplicates. The roots of the denominator are included: they are the values where the expression is undefined.

      Returns Solution[]

    • Add one or more PolyFactors to this one.

      Algorithm: compute the LCM of all denominators, scale each numerator by its complementary factor, then extract the GCD of the scaled numerators and collect the residuals into a single polynomial factor.

      Parameters

      Returns this

    • Copy the mathematical state of another instance into this (display state is NOT transferred — the receiver keeps its own formatting). Entry point used when constructing/parsing from a same-type input. Distinct from clone. Classes without a real implementation throw NotImplementedError.

      Parameters

      Returns this

    • Derivative, by the product rule. The result is added with add, so it is factored again.

      Returns this

    • Group the factors with the same base by adding their powers, remove the factors of power zero, and merge the monomial factors with an integer power.

      Returns this

    • Reoarder the factors using :

      1. number of monoms
      2. degree of polynom
      3. power of polyfactor

      Parameters

      • Optionalvariable: string

      Returns this

    • Build a polyfactor from a product of parenthesised terms, with at most one / for the denominator.

      Parameters

      • value: string

      Returns PolyFactor

      if the numerator is empty or the string has more than one /.