Quantifying a generated result's error

A heater has four power readings of 100100, 200200, 300300, and 400 W400\ \text{W} at times 00, 33, 66, and 9 s9\ \text{s}. The required energy estimate uses trapezoidal integration:


Eref=Δt1000(P02+P1+P2+P32),E_{\text{ref}}=\frac{\Delta t}{1000}\left(\frac{P_0}{2}+P_1+P_2+\frac{P_3}{2}\right),


where energy is in kilojoules. An AI-generated function instead returns


EAI=Δt1000(P0+P1+P2+P3).E_{\text{AI}}=\frac{\Delta t}{1000}(P_0+P_1+P_2+P_3).


Calculate its absolute relative error, defined as 100∣EAI−Eref∣/∣Eref∣100|E_{\text{AI}}-E_{\text{ref}}|/|E_{\text{ref}}|. Answer in percent, to one decimal place. Enter only the number.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Use of AI in Programming Questions: