An engineering analysis program separates its work into three modules:
A cache stores a module's inputs and resulting output for reuse. For this problem, a saved output is reused exactly when all that module's inputs are unchanged. Each distinct input combination is computed only once. Calls run sequentially, and lookup and storage time are negligible.
The initial analysis starts with an empty cache. It uses two geometries, A and B, and three materials, M1, M2, and M3. Every geometry is combined with every material. For each geometry–material pair, the solve module processes five distinct load cases. Assume no distinct combinations produce identical intermediate data.
After the initial analysis finishes, the engineer simultaneously changes geometry A and the elastic modulus of M2. Geometry B, the other two material moduli, and all five load cases remain unchanged. Each changed input produces different downstream data. The program then updates the complete analysis, retaining every unaffected saved result.
Find:
Unlock full course notes by signing up
Following quantities through module handoffs
A heater-test program has three modules. Its input adapter converts elapsed time from minutes to seconds. Its calculation module accepts constant power in watts and elapsed time in seconds, returning E=PΔtE=P\Delta tE=PΔt in joules. Its reporting module divides the energy in joules by 1000 to display kilojoules.
The recorded power is 135 W135\ \text{W}135 W and the elapsed time is 2.50 min2.50\ \text{min}2.50 min. What energy should the reporting module display? Give your answer in kilojoules, to two decimal places.
Checking independence between batch calls
A laboratory program calls an energy-summary module once per test batch. Its interface promises to return the total energy for the current batch, in joules, independently of earlier batches.
Two implementations use the same inputs and output units:
Implementation R resets its internal total to zero at the start of every call, adds the current batch's readings, and returns the total.
Finding a failure between tested modules
A mechanical-work program uses an input adapter, a calculation module, and a reporting module. The calculation contract is W=FdW=FdW=Fd, with force in newtons, displacement in metres, and work returned in joules. Reporting converts joules to kilojoules.
After support for a new recorder is added, these tests are observed:
Which response best uses this evidence while preserving the documented module contracts?
Preserving numerical meaning during replacement
An energy module accepts one or more intervals, each containing a finite nonnegative power PiP_iPi in watts and a finite positive duration Δti\Delta t_iΔti in seconds. Its public contract returns total energy in joules:
A replacement keeps the same inputs and output type but calculates the ordinary arithmetic mean of the powers and multiplies it by the total duration. It passes tests with one interval and tests with equal interval durations.