IIntegralThistle
Workflows

Coding workflows · Exact polynomial antiderivatives

03
Built around your work

A concrete starting point

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.

01

Open the context

Choose the project folder and name the files or behavior involved.

02

Define the change

Describe the input, expected output and boundaries that must stay intact.

03

Inspect the work

Review the proposed edits and any commands before relying on their result.

04

Check the outcome

Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

Exact polynomial antiderivatives

A concrete starting point
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.

AI coding workspace

Your next change starts here.

Get the Windows app ↗