Mark Yourself Question
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
On a calibration trace of four readings, all 200 W200\ \text{W}200 W, spaced 2 s2\ \text{s}2 s apart, the raw function returns 1.60 kJ1.60\ \text{kJ}1.60 kJ and the reference gives 1.20 kJ1.20\ \text{kJ}1.20 kJ. The AI assistant proposes multiplying every raw result by 0.750.750.75 and claims the function is now verified for all valid inputs.
a) Evaluate that correction for readings [100,500,100] W[100,500,100]\ \text{W}[100,500,100] W spaced 3 s3\ \text{s}3 s apart. Calculate the reference energy, corrected energy, and absolute relative error in percent.
b) For a trace whose sum of readings is positive, derive the factor Eref/ErawE_{\text{ref}}/E_{\text{raw}}Eref/Eraw. Explain whether the calibration establishes a universal factor.
c) State a replacement calculation and propose two independently calculated acceptance tests that challenge different features of it. Explain what passing those tests would establish.
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.
Choosing a test that separates implementations
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:
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.