Open the context
Choose the project folder and name the files or behavior involved.
Integrate a polynomial supplied as zero to 64 integer coefficients in ascending degree, each within ±10^9, returning rational coefficients with a fixed zero constant. Test empty and trailing-zero inputs by differentiating the result, rejecting Boolean or out-of-range coefficients without numerical quadrature.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
from fractions import Fraction
def antiderivative(coefficients):
if type(coefficients) is not list or len(coefficients) > 64:
raise ValueError("integral.input")
if any(type(value) is not int or abs(value) > 10**9 for value in coefficients):
raise ValueError("integral.coefficient")
return [Fraction(0)] + [Fraction(value, degree+1)
for degree, value in enumerate(coefficients)]
The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.