crowlogic / arb4j

arb4j is a Java API for the arbitrary precision ball arithmetic library found at http://arblib.org
Other
1 stars 0 forks source link

Test Cases for Polynomial Operations with Remainders #438

Closed crowlogic closed 2 weeks ago

crowlogic commented 3 weeks ago

Test Cases for Polynomial Operations with Remainders

1. Division to Create Remainder

Test Case: Division with Remainder

2. Addition Test with Remainder

Test Case: Addition Involving a Remainder

3. Subtraction Test with Remainder

Test Case: Subtraction Involving a Remainder

4. Multiplication Test with Remainder

Test Case: Multiplication Involving a Remainder

Subject: Seeking Advice on Polynomial with Remainder Implementation

Dear Flint Development Team,

I am working on ARB4J, a SWIG wrapper for ArbLib in Java. I am implementing polynomial operations that include the quotient and remainder arithmetic to handle functions efficiently.

I considered using general function composition to handle this, but that leads to a proliferation of lazily evaluated functions, which is not efficient.

Context:

I am working with hypergeometric functions that result in rational function outputs instead of polynomial results. If implemented naively using standard polynomial arithmetic, this would silently give zero and result in incorrect outputs. By propagating the remainders, the results are accurate and can handle any hypergeometric function or expressions that have rational results but intermediate steps that can't be represented as polynomials. This approach ensures correct propagation of intermediate results and maintains mathematical integrity.

Example:

  1. Division: x / x^2 = [Value = 0, Remainder = x, Quotient = x^2]

  2. Multiplication: [Value = 0, Remainder = x, Quotient = x^2] * x = [Value = 1, Remainder = 0, Quotient = 0]

Question:

Is this an acceptable way to handle this situation, or should I make the rational function type a member of the polynomial and store the quotient and divisor that way?

Looking forward to your insights.

Best regards, [Your Name]