Scientific Computing and Reproducible Workflows, TMP-SCI-204. Keep this key separate from a learner's first attempt. Results below are mathematical derivations and author-side execution observations, not evidence that a learner ran anything. Equivalent exact forms and well-justified explanations are acceptable. Do not award execution points for predicted output, copied logs or screenshots of the author's run.
The quiz totals 30 and project 40 formative points. They are separate practice groups, not an accredited grade or a calibrated assessment. No fixed pass mark is validated. A learner should correct conceptual errors, rerun affected work if able, and retain the original and revision rather than hiding the first attempt. Numerical comparisons below use the checked binary radix-2, 53-significant-bit environment. Other environments should be documented and investigated, not forced to print the same observations.
Readiness
R1
125/1000=1/8 and 126/1000=63/500. Their difference in the stated later-minus-earlier order is 1/1000. The order matters: reversing the operands changes the sign. Cancelling an identical integer baseline is valid in exact arithmetic. This calculation establishes an exact result for the stated numbers, not a physical confidence interval.
If the learner subtracts denominators, return to a common denominator: 126/1000-125/1000=(126-125)/1000. If they treat 0.001 as 1/100, use place value before continuing. These are important preparation gaps rather than reasons to add an unstated formal prerequisite.
R2
Absolute difference is |0.004-0.005|=0.001. Relative error against reference 0.005 is 0.001/0.005=0.2. Percentage error is 20%, not 0.2%. Absolute error would inherit the measurement unit; relative and percentage errors are dimensionless. The sign of a-r would indicate an underestimate, but absolute error deliberately discards that sign.
R3
Let recorded readings be x and y and the respective unknown errors be e_x and e_y, each in [-0.2,0.2]. The true difference differs from the recorded difference by e_y-e_x. Choosing e_y=+0.2 and e_x=-0.2 produces +0.4; reversing those choices produces -0.4. The conservative difference error is therefore bounded by 0.4. A smaller bound needs additional information about dependence or a shared error structure. There is no probability claim here.
R4
A predicted output and a test design are honest conceptual deliverables. Without execution the learner cannot claim that the tests passed or that they produced an actual run record. They can quote the author's observation if clearly attributed, but attribution does not convert it into their execution. Computational-performance outcomes remain unmet until real execution evidence is available.
Guided work
G1
7/16 has a finite binary expansion because 16=2^4. 3/20 is reduced and 20 contains a factor of 5, so its binary expansion does not terminate. 9/12 reduces to 3/4 and therefore terminates. 1/10 includes a factor of 5 and does not terminate. The criterion concerns representability by an unlimited finite binary string; a particular float has a finite number of significant bits and a finite exponent range. A huge numerator or an extremely small power-of-two denominator can exceed those limits even though the mathematical expansion is finite.
Award reasoning, not just four labels. A learner who tests only a denominator before reducing would incorrectly reject 9/12. A learner who says that finite expansion guarantees fit is overlooking the difference between a number system and a particular finite storage format.
G2
The integer expression returns 1. In the checked float format N+1 rounds to N, so the second expression returns 0.0. N=9007199254740992. The next representable float above N is N+2. N+1 is halfway, and the checked ties-to-even rule selects N. Subtracting N from the already converted values therefore subtracts equal numbers. No later subtraction, formatter or more accurate summation can infer the missing tick from those two floats alone.
A valid execution submission records the interpreter and both expressions/results. A prediction-only submission can still earn conceptual recognition but not execution credit. The existence of other possible integer tokens mapping to the same float is another way to explain why recovery is impossible without additional evidence.
G3
The reference is 0.001=1/1000 m. The checked approximation is 1/1024 m. Their difference is (1024-1000)/(1024000)=24/1024000=3/128000 m. Divide by 1/1000 to obtain 3/128=0.0234375, or 2.34375%. The approximation is lower than the exact-token reference.
This is numerical error against a mathematical reference constructed from the supplied decimal tokens. It does not describe physical uncertainty or an instrument's calibration. It is possible for the actual physical difference to be larger or smaller than either numerical result under a different measurement model. The error diagnosis is not “subtraction introduced exactly this much new rounding”: the stored operands already differ from the intended inputs.
G4
Workflow (a) yields 1/1024 in this case. Workflow (b) retains exact tokens long enough to remove the common baseline, giving residual tokens 0.126 and 0.125 before conversion; their float difference is much closer to 0.001, though not necessarily exact. Workflow (c) cannot undo the first conversion. Here subtracting the baseline from the stored full readings yields stored residuals whose difference remains 1/1024.
Workflow (b) requires recoverable original decimal tokens and an explicit exact common baseline. Keeping the baseline separately is a data-design choice that must preserve units and meaning. A baseline guessed from the rounded output is not original evidence. Exact rational token subtraction is also valid for this bounded arithmetic, but does not make the physical readings error-free.
G5
Left-to-right [2^54,3,-2^54] gives 4.0 in the checked environment; [2^54,-2^54,3] gives 3.0. Both exact sums are 3. math.fsum gives 3.0 for both. The float values of these three integer tokens are exact, so the differing result arises in accumulation, not initial conversion.
In contrast, [N+1,-N] has exact-token sum 1 but converted float values [N,-N]. Both the explicit sequential loop and fsum return 0.0. A better summation routine cannot retain a component never present in its inputs. This pair of examples separates input conversion from algorithmic accumulation. Do not substitute a version-dependent built-in sum experiment for the explicit loop and still claim to have tested the same algorithm.
G6
At 1000 versus 1001, absolute difference=1 and allowance=max(0,0.001×1001)=1.001, so the comparison passes. At 1 versus 2, difference=1 and allowance=0.002, so it fails. At zero versus 2e-9, a relative-only allowance with rel_tol=.01 is 2e-11, so it fails. Using abs_tol=3e-9 and rel_tol=0 permits 3e-9 and passes.
Changing metres to millimetres multiplies values and absolute tolerances by 1000. Relative tolerance remains unchanged. If abs_tol is not converted, the test no longer expresses the same physical allowance. These calculations explain the rule; merely obtaining a True or False output does not justify the chosen tolerance.
Independent practice
I1
Fraction('0.2') is 1/5. In the checked float environment, Fraction(0.2) is 3602879701896397/18014398509481984. The latter is slightly greater than 1/5 and exactly describes the stored binary float. The string constructor preserves the specified decimal number; the float constructor preserves a different already-rounded input. Neither proves the measurement was correct. A fraction library guarantees neither units nor calibration nor that the token was transcribed properly.
I2
17.375-17.125=0.25=1/4. Both operands and their difference fit the checked binary format exactly, so the numerical error is zero. The readings are relatively close, but subtraction is not automatically inaccurate. In the large-offset example, input spacing is too coarse to preserve the desired thousandth-metre difference well. Size, spacing and input representation matter together; “close numbers” alone is not a sufficient diagnosis.
I3
Absolute error is 0.0002 units. Relative error against zero is undefined, not zero or a finite percentage. The stipulated budget supports close_finite(0.0002,0.0,rel_tol=0.0,abs_tol=0.0003), which returns True. This says the calculation meets that numerical acceptance rule. It does not establish the budget's scientific adequacy or show that the implementation is correct on other cases.
I4
3/128000 m multiplied by 1000 becomes 3/128 mm = 0.0234375 mm. The exact reference 0.001 m is 1 mm. The relative error is therefore (3/128)/1=3/128=2.34375%, unchanged. Confusing 0.0234375 mm with 2.34375 mm would be a factor-of-100 error, not a rounding detail. Keeping units alongside each operation helps expose it.
I5
Use 0, 1 and 2. With absolute tolerance 1 and relative tolerance zero, 0 is close to 1 and 1 is close to 2, but 0 is not close to 2. Thus this approximate-equality relation is not transitive. A chain of pairwise passes does not guarantee that the first and last values meet the same budget. Do not use such a chain as a substitute for comparing every result with the stated reference.
I6
One defensible set:
- Input conversion: N+1 and -N have exact token sum 1 but fsum result zero. This detects loss before accumulation, not measurement truth.
- Accumulation: [2^54,3,-2^54] versus reordered terms have identical exact sum 3 but sequential outputs 4 and 3. This tests the specified algorithm, not every possible sum or platform.
- Zero reference: equal tokens produce absolute error zero and relative error null; a separate nonzero approximation against zero has undefined relative error. This prevents a fabricated relative percentage, not all scientific misuse of zero.
- Nonfinite input:
close_finite(float('nan'),1.0,rel_tol=.01,abs_tol=0.0)must raise ValueError. This tests explicit rejection, not recovery from an invalid experiment.
Expectations must be written independently, not computed by calling the same helper being tested. Accept equivalent bounded discriminating cases with explained limitations.
Audit
H1
Display rounding maps many distinct stored values to the same text. For example, values 1.0001 and 1.0002 both display as 1.000 with three fixed decimal places, but remain different values. Equal formatted strings are evidence of equal display under that rule only. They do not imply equal bits, equal exact numbers or equal measurements.
H2
A numerical tolerance comparison concerns agreement between numbers according to a chosen rule. Instrument accuracy requires an appropriate measurement model, calibration/reference evidence, operating conditions and error characterization. Even identical calculations can share the same wrong model or corrupted input. A 5% numerical comparison does not supply a 5% physical accuracy guarantee or a confidence level.
H3
The exact-binary 17.375-17.125 example refutes “always inaccurate”: its result is exactly 1/4. The N+1,-N input-loss example refutes “fsum makes all arithmetic exact”: it returns zero against exact-token sum 1. Furthermore fsum addresses summation, not every operation. Refuting a universal claim needs a counterexample, not a claim that the opposite universal statement is true.
Quiz: 30 points
Q1 — 6 points
Reference difference=0.003=3/1000 m. The approximation 25/8192=0.0030517578125 m is above the reference. Absolute error is 25/8192-3/1000=(25000-24576)/8192000=424/8192000=53/1024000 m = 0.0000517578125 m. Relative error is (53/1024000)/(3/1000)=53/3072, approximately 0.0172526041667. Percentage error is approximately 1.72526041667%.
Rubric: exact nominal difference 1; correct common-denominator absolute derivation 2; relative ratio 1; percentage conversion 1; units/reference and direction clearly identified 1. Rounding within a stated sensible precision is acceptable. Do not subtract rounded three-decimal displays, which would conceal the error.
Q2 — 6 points
Use rel_tol=0 and abs_tol=0.00004 m. The actual absolute discrepancy is 0.0000517578125 m, exceeding the budget, so it fails. A wider tolerance does not repair the input representation or algorithm; it changes what error is accepted. A revised budget would require a new external justification and an honestly documented specification change, not a post-hoc attempt to get a green result.
Rubric: absolute-only parameters 2; correct discrepancy comparison 2; fail conclusion 1; explanation of budget revision versus correction 1. The question supplies a numerical specification, not an instrument uncertainty estimate.
Q3 — 6 points
Nominal difference is 0.003 m, and the combined worst-case bound is 0.0002+0.0002=0.0004 m. Therefore physical difference lies in [0.0026,0.0034] m. Because this interval includes values below, equal to and above 0.0032 m, it does not establish that the physical difference is strictly above that threshold. This is a deterministic bound under stated assumptions, not a confidence interval.
Rubric: correct bound construction 2; endpoints 2; threshold conclusion 1; correct interpretation 1. A claim that separate errors average out is unsupported. No probability distribution was supplied.
Q4 — 6 points
Exact subtraction operates on the original decimal tokens and gives 3/1000. Recentring those preserved tokens before conversion can keep small residuals at a finer float spacing and greatly reduce this cancellation problem. Recentring after full-token conversion keeps the original loss; it cannot reverse it. If original tokens no longer exist, none of these methods can uniquely reconstruct their lost information from the rounded floats alone. Additional trustworthy source evidence would be required.
Rubric: exact-token workflow 1; before-conversion workflow and reason 2; after-conversion limitation 2; recoverability statement 1. Do not call recentering universally exact.
Q5 — 6 points
A valid record predicts 3/1000 and 1/4 references, uses the supplied quiz and exact-binary cases, records the checked results separately, and explains why the latter has zero numerical error while the former does not. A discriminating test could require the exact-binary error to be zero while ensuring that the quiz fails the 0.00004 m budget. A limitation may concern the artificial scale, original-token model or unverified measurement truth.
Rubric: predictions 1; reproducible command/source identification 1; two correctly interpreted results 1; discriminating test 1; limitation and explicit executed/traced status 1; authentic actual execution evidence 1. Trace-only work can earn at most 5/6 and must not invent output. Source identification on a trace can describe the intended file without falsely claiming a computed hash.
Project: 40 points
P1 — 8 points
Nominal displacement is 0.005=1/200 m. With exactly 2 s elapsed, nominal rate is 1/400=0.0025 m/s. The checked float displacement is 41/8192=0.0050048828125 m. Its absolute numerical error is 41/8192-1/200=(8200-8192)/1638400=1/204800 m = 0.0000048828125 m. Relative error is (1/204800)/(1/200)=1/1024=0.0009765625, or 0.09765625%.
The checked float rate is 41/16384=0.00250244140625 m/s. Its absolute error against nominal rate is 1/409600 m/s, with the same relative error. Halving both reference and approximation halves their absolute discrepancy but preserves the ratio.
Rubric: displacement 1; exact rate and units 1; absolute error derivation 2; relative error/percentage 2; float rate 1; clear reference versus physical-value distinction 1.
P2 — 8 points
The full-token case reports 41/8192. Recentered decimal residual tokens 0.130 and 0.125 give float difference 0.0050000000000000044 in the checked environment. Its exact binary value is 45035996273705/9007199254740992, with absolute error 1/225179981368524800 m, approximately 4.44×10^-18 m. It is much closer to the exact reference but not exactly equal to it.
Reproduce from the preserved source into a second new directory. Under the same checked conditions report bytes should match; output path and invocation arguments can differ in run metadata. Validate completion JSON and the two known source/report digests. Do not infer successful reproduction from a matching filename or from a completion string alone.
Rubric: predicted comparisons and explanation of the two methods 2; correct provenance/comparison plan 1; authentic initial execution evidence 2; authentic repeat-from-snapshot evidence 2; actually verified file comparisons/hashes 1. The last five points require execution. Trace-only work is explicitly capped at 3/8. A partial or failed run should be preserved and accurately described, not presented as complete.
P3 — 8 points
Separately bounded position errors allow displacement error at most 0.0004 m. Physical displacement therefore lies in [0.0046,0.0054] m. Dividing by the exact positive time 2 gives rate interval [0.0023,0.0027] m/s. The threshold 0.00255 lies inside that interval. Neither “definitely above” nor “definitely not above” follows. The nominal rate is below the threshold, but a nominal estimate is not a guaranteed physical value.
Rubric: correct worst-case combination 2; displacement endpoints 2; rate endpoints 2; justified inconclusive threshold decision 1; separate numerical/measurement meanings 1. These endpoints are based on exact nominal tokens and stated measurement bounds. Do not accidentally centre the physical interval on the rounded float result while omitting its numerical error. If centring on an approximation, account for the additional numerical discrepancy explicitly.
P4 — 8 points
Exact rational subtraction of the preserved decimal tokens gives 1/200. Full-token float subtraction gives 41/8192. Exact baseline removal followed by residual float conversion gives a closer but still approximate result. Preserve original tokens, units, chosen baseline, residual derivation and code so the representation choice can be audited. If the tokens are already gone, describe that as lost evidence rather than asserting the residuals must have been 0.125 and 0.130.
One useful challenge to a universal repair is [N+1,-N]: fsum cannot recover the initial conversion loss. Another is the nonzero recentered error, refuting “recentering makes every decimal calculation exact.” Rounding both residuals for display before calculation is not a defensible universal repair either.
Rubric: correct three-way comparison 3; before-versus-after conversion timing 2; recoverable provenance plan 1; independent counterexample with interpreted result 2.
P5 — 8 points
Example conceptual report, approximately 175 words; its execution clause must be replaced by the learner's true status:
The fictional task estimates displacement rate from decimal position tokens 1000000000000.125 m and 1000000000000.130 m over an exact two-second interval. Exact token subtraction gives 0.005 m and a nominal rate of 0.0025 m/s. The supplied full-token float method instead gives 0.0050048828125 m, an absolute numerical discrepancy of 0.0000048828125 m against the token reference. Removing the exact common baseline before conversion greatly reduces this discrepancy but does not make every result exact. Under the separately supplied 0.0002 m bounds on each reading, physical rate lies between 0.0023 and 0.0027 m/s. That range crosses the 0.00255 m/s threshold, so it does not establish a rate definitely above it. This account is a mathematical trace, not my execution record. A completed computational submission would preserve my source snapshot, output, interpreter and verified hashes in new run folders. The data are fictional, the elapsed time is stipulated exact, and no calibration evidence or real instrument test is supplied. Better numerical precision alone would not resolve the threshold decision.
Rubric: question/input model/units 1; numerical result and reference 2; physical bounds 1; threshold conclusion 1; accurate actual-versus-traced status 1; recoverable evidence description 1; meaningful limitation 1. A truthful trace can earn these communication points, but cannot recover P2's execution-only points. This avoids counting prose as computational performance.
Delayed transfer
D1
Subtract exact integer ticks first: (N+1)-N=1 tick. Multiply by the exact conversion 2/1000=1/500 seconds per tick, giving elapsed time 1/500 s = 0.002 s. Preserve the tick difference and conversion factor as exact integers/rationals if later calculations need that accuracy. Convert only the smaller result when an approximate interface requires it, and label its representation. Converting both full counts to floats first collapses them to the same value in the checked format and gives a false zero interval. This task changes the data model from decimal positions to integer counters; the original float workflow should not be copied blindly.
D2
Under separate individual bounds, difference error is at most 0.3+0.3=0.6 units. If the only error is truly the same shared offset c in both readings, then (y+c)-(x+c)=y-x and that offset contributes zero difference error. The stronger conclusion requires documented evidence that the offsets are identical for the relevant readings and that no separate noise, drift, rounding or other errors remain. Merely using the same sensor brand or seeing similar readings does not establish that model.
Feedback and limits
Give feedback on the error source the learner actually confuses: representation, algorithm, display, measurement model, tolerance specification or evidence status. A corrected final number without a corrected explanation may conceal the same misunderstanding. Invite a changed-input retest and a short explanation of what evidence would overturn their conclusion. Specialist moderation, rubric calibration, learner timing and actual assistive-technology validation remain unperformed. No certification or institutional-equivalence inference is justified.