Two AI-generated functions estimate energy from three equally spaced power readings. One uses sample-mean power multiplied by the record duration:
The other implements the required trapezoidal model:
Power is in watts, spacing is in seconds, and energy is in kilojoules. Both functions have passed a constant-power test. Which additional test produces different outputs from the two functions, with the stated expected value calculated from the required model? Use Δt=4 s\Delta t=4\ \text{s}Δt=4 s in every case.
Use readings [0,150,0] W[0,150,0]\ \text{W}[0,150,0] W and expect 0.600 kJ0.600\ \text{kJ}0.600 kJ.
Use readings [150,150,150] W[150,150,150]\ \text{W}[150,150,150] W and expect 1.200 kJ1.200\ \text{kJ}1.200 kJ.
Use readings [0,150,300] W[0,150,300]\ \text{W}[0,150,300] W and expect 1.200 kJ1.200\ \text{kJ}1.200 kJ.
Use readings [300,150,0] W[300,150,0]\ \text{W}[300,150,0] W and expect 1.200 kJ1.200\ \text{kJ}1.200 kJ.
Unlock full course notes by signing up
Quantifying a generated result's error
A heater has four power readings of 100100100, 200200200, 300300300, and 400 W400\ \text{W}400 W at times 000, 333, 666, and 9 s9\ \text{s}9 s. The required energy estimate uses trapezoidal integration:
where energy is in kilojoules. An AI-generated function instead returns
Counting the complete AI-assisted workflow
An engineering programmer records completion times for three tasks using two alternative workflows. Both workflows finish with code that meets the same stated requirements. Each workflow runs sequentially, and the recorded phases do not overlap. Prompting time includes waiting for the AI response; revision time includes all subsequent corrections and rechecks.
Define net time saving as manual completion time minus total AI-assisted completion time. Complete the table with exact integer minutes. A negative saving means that the AI-assisted workflow takes longer.
Does a fitted correction generalize?
An AI-generated energy function accepts n≥2n\geq2n≥2 finite, nonnegative power readings in watts and a finite positive spacing Δt\Delta tΔt in seconds. It returns
in kilojoules. The required model is
Checking an AI proposal against a memory budget
An AI assistant proposes a numerical program that retains a full N×NN\times NN×N distance matrix for N=10 000N=10\,000N=10000 three-dimensional points. Every matrix entry occupies 8 bytes. The program has a strict total budget of 512 MiB, and all memory outside the distance matrix occupies exactly 128 MiB under the supplied planning model. Use 1 MiB=1 048 576 bytes1\ \text{MiB}=1\,048\,576\ \text{bytes}1 MiB=1048576 bytes.
You request a revised implementation that processes rrr rows at a time without retaining the full matrix. In this revised plan, the fixed allocation is still 128 MiB. In addition, each block requires these three arrays:
Coordinate differences: r×N×3r\times N\times3r×N×3 entries, each occupying 8 bytes.