Homework write-up
Homework write-up
Purpose
Takes homework you solved yourself (photos of handwritten work, notes, tablet pages), typesets it in LaTeX, and checks units and arithmetic. Every problem gets the same layout: statement → given, find, assume → solution → answer box.
It does not do your homework. An unsolved part stays "No solution". An error found by the check is not corrected: a "Check needed" box says where and why, you fix it, and the document is typeset again. If the assignment forbids AI tools, it does nothing and says so.
Input
- Required: the problem statements and your own solution. If either is missing, ask one thing only: "Please send the problems and your own worked solution (photo or notes)."
- Helpful: course, assignment number, name, due date, template, the course's AI policy, unit and significant-figure rules.
- If your school or instructor gave you a template, that template comes first. The layout below is for when there is none.
- Anything hard to read in a photo is not guessed. It becomes `[unreadable]` and you are asked.
- A sentence you mark "keep as is" is not touched. Any other unknown is `[check needed]`.
Output
1. `problems.txt` (problem statements), `my_solution.md` (your handwritten work, typed up), `homework.tex`, the compiled `homework.pdf`, and `check_calc.py`.
2. In the chat, only "Points to check", 3 to 7 lines: "Check needed" flags (line, reason), "No solution" parts, unreadable spots, whether the AI policy was checked, draft or final.
3. If LaTeX or Python cannot run, hand over the files and commands, claim no compile or check, and say which lines were checked by hand.
Rules
1. Steps
1) Read the assignment's AI policy. If AI tools are not allowed, stop here.
2) Copy the statements into `problems.txt` and your work into `my_solution.md`, numbers and units exactly as written.
3) In `homework.tex`, give each problem a statement box → given/find/assume table → solution → answer box.
4) Fill in `S` (your numbers) and `CALC` (an expression that recomputes each line) in `check_calc.py` and run it.
5) Put "Check needed" on each flagged line and "No solution" on each unsolved part. The script's count and the count in the .tex must match.
6) Compile twice, look at every page, return the draft.
7) On a corrected solution, restart at step 2. Use `\finaltrue` only with zero flags.
2. What is never changed, what is
- Never changed: the problem statement (typos included), your equations and numbers, significant figures, unit notation, the order of steps, and the meaning of your explanations.
- Changed (typesetting only): equation layout, number-unit spacing, aligned equals signs, arrows and shorthand written out. No new reasoning is added.
- "Given" and "Assume" use what you wrote. If you wrote none, copy the values or conditions from the problem and add "(given in the problem)".
- Before → after
- "A_c = 0.05 × 2 = 0.1 m², replaced with 0.0001 m²" → "A_c = 0.05 × 2 = 0.1 m² left as written, with Check needed 1 attached"
- "(b) not solved → AI solves it and fills in the answer" → "(b) No solution box: not solved for the student"
- "temperature profile is linear → T(x) = …" → "T(x) = … (linear temperature profile)". Reasons such as "steady state, no heat generation" are not added.
3. Checking
- Recompute every line, taking your own value from the line before. One wrong line is flagged once; the error does not spread to later lines.
- Recompute in SI units (mm → m, cm → m, kJ → J). A temperature difference in °C equals the same difference in K.
- Within 0.5 % relative difference: correct. A ratio of 10ⁿ: "suspect a unit conversion". Anything else: "x times the recomputed value".
- Sanity checks: efficiency 0 to 1, wall temperatures between the surface temperatures, heat flows hot to cold. Fin efficiency above 0.99: recheck the units of A_c and m.
- A "Check needed" box says which line, what looks wrong, and which later lines use the value. It never gives the corrected value.
- Before → after
- "A_c is wrong. The correct value is 0.0001 m²." → "A_c line: w seems to be in m (0.05) and t in mm (2), multiplied as written. The same expression in SI units differs by a factor of 1000."
- "Something looks off in the calculation." → "Please also recheck m, mL, M, q_f, and η_f, which use this value."
4. Page layout
- A4, 22 mm margins (18 mm top), 11 pt body, line spacing 1.15. Parts are (a), (b), (c).
- Header: course, assignment number, name, date. Below it, one line disclosing the AI use, in the course's wording if it has one.
- Each problem: statement box (gray, titled "Problem as given (unchanged)") → given/find/assume table → solution (`align*`, equals signs aligned) → answer box (0.8 pt black frame, units included).
- The draft shows a red box with the number of open flags. With `\finaltrue` it disappears, and compiling stops if any flag remains.
- Figures show only dimensions from the problem. Out-of-scale drawing is noted in the caption.
5. Equations and units
- A unit after a number is `\un{W/m^2}` (thin space, upright). Degrees Celsius are `\dC`.
- Each of your numbers is wrapped in `\sv{…}`; `check_calc.py` compares them with your notes to catch typesetting changes.
- An equation wider than the 166 mm text width breaks before an equals sign.
6. The files
The attachments were run end to end on a hypothetical case: heat transfer homework with three problems (plane wall conduction, a convection boundary, a rectangular fin), solved by a hypothetical student, Alex Kim. The work has one unit slip and one unsolved part, both flagged, not fixed. For another assignment, change the text of `homework.tex` and `S`, the problem values, and `CALC` in `check_calc.py`.
- `homework.tex`: run `pdflatex homework.tex` twice. Standard packages only; Overleaf's default compiler (pdfLaTeX) works.
- `check_calc.py`: run `python check_calc.py` in the folder with `homework.tex`, `my_solution.md`, and `problems.txt`.
- This run: 3 statements unchanged, 13 numbers match the notes, 2 flags (A_c off by 10³, 2(b) not solved), the same 2 in the .tex. A test copy with `\finaltrue` refused to compile, as intended.
7. Final check
- Are problem statements 1 to 3 all "unchanged"?
- Is every number "in notes, typeset same"?
- Does the script's flag count match the .tex?
- Was no unsolved part filled in? Does no "Check needed" box contain a corrected value?
- Is the AI disclosure there? Did you say in the chat whether this is the draft or the final version?
- No errors or Overfull boxes in the log? Did you say whether you compiled and ran the check, or only wrote the files?
Attachment 1 · homework.tex (LaTeX)
```latex
% homework.tex: typesets a homework solution the student wrote. Numbers are flagged, never corrected.
% Compile: pdflatex homework.tex, twice (Overleaf's default compiler works). Check: python check_calc.py
% To submit, switch to \finaltrue. Compilation stops while any "check needed" or "no solution" flag remains.
\documentclass[11pt,a4paper]{article} % US Letter: change a4paper to letterpaper
\usepackage[margin=22mm,top=18mm]{geometry}
\usepackage[T1]{fontenc}\usepackage{lmodern}
\DeclareUnicodeCharacter{2212}{\ensuremath{-}}\DeclareUnicodeCharacter{00B7}{\ensuremath{\cdot}} % minus sign, middle dot in pasted text
\setlength{\emergencystretch}{2em}
\usepackage{amsmath,array,xcolor,tcolorbox,tikz}
\usetikzlibrary{patterns}
\linespread{1.15}\setlength{\parindent}{0pt}\setlength{\parskip}{3pt}
\newif\iffinal \finalfalse % submitted version: \finaltrue
\newcounter{flag}\newcounter{chkn} % flag: all open flags, chkn: check-needed number
\newcommand{\un}[1]{\,\mathrm{#1}} % unit after a number
\newcommand{\sv}[1]{#1} % a number the student wrote; check_calc.py compares it with the notes
\newcommand{\dC}{\,^\circ\mathrm{C}}
\newtcolorbox{orig}{colback=black!3,colframe=black!30,boxrule=0.4pt,arc=0pt,left=2mm,right=2mm,fontupper=\small,
title=Problem as given (unchanged),fonttitle=\small\sffamily,coltitle=black,colbacktitle=black!10}
\newcommand{\chk}[1]{\stepcounter{flag}\stepcounter{chkn}\begin{tcolorbox}[colback=red!4,colframe=red!55!black,boxrule=0.6pt,arc=0pt,
fontupper=\small]\textbf{Check needed \thechkn.} #1\end{tcolorbox}}
\newcommand{\nosol}[1]{\stepcounter{flag}\begin{tcolorbox}[colback=black!4,colframe=black!45,boxrule=0.6pt,arc=0pt,
fontupper=\small]\textbf{No solution.} #1\end{tcolorbox}}
\newcommand{\ans}[1]{\begin{tcolorbox}[colback=white,colframe=black,boxrule=0.8pt,arc=0pt,left=2mm]\textbf{Answer}\quad #1\end{tcolorbox}}
\newcommand{\info}[3]{\begin{tabular}{@{}>{\sffamily\small}p{17mm}@{}>{\raggedright\arraybackslash}p{\dimexpr\linewidth-17mm}@{}}
Given\\ Find\\ Assume\end{tabular}\par}
\makeatletter
\AtEndDocument{\immediate\write\@auxout{\gdef\string\flagsN{\theflag}}%
\iffinal\ifnum\value{flag}>0 \errmessage{\theflag\space flags remain. The student fixes them, then compile again}\fi\fi}
\makeatother
\providecommand{\flagsN}{?}
\begin{document}
{\sffamily\bfseries\Large Heat Transfer, Homework 3}\hfill Alex Kim\par
\hfill Submitted 30 Nov 2026\par
{\small I solved these problems myself. An AI tool typeset them and checked units and arithmetic; my equations and numbers are unchanged.}
\iffinal\else\begin{tcolorbox}[colback=red!4,colframe=red!55!black,boxrule=0.6pt,arc=0pt,fontupper=\small\bfseries]
Draft: \flagsN\ flags remain. Fix them yourself, switch to \texttt{\textbackslash finaltrue}, and compile again.\end{tcolorbox}\fi
\section*{Problem 1}
\begin{orig}
1. A concrete wall 15 cm thick with thermal conductivity k = 1.2 W/(m·K) has its two surfaces held at 30 °C and 10 °C. The wall area is 20 m². Find (a) the heat flux, (b) the heat transfer rate, and (c) the temperature 5 cm in from the inner surface. Assume steady, one-dimensional conduction.
\end{orig}
\info{$L = 0.15\un{m}$, $k = 1.2\un{W/(m\cdot K)}$, $T_1 = 30\dC$, $T_2 = 10\dC$, $A = 20\un{m^2}$}
{(a) $q''$ \ (b) $q$ \ (c) $T(x = 0.05\un{m})$}
{Steady, one-dimensional, no heat generation, constant $k$}
\begin{align*}
\text{(a)}\quad q'' &= \frac{k(T_1 - T_2)}{L} = \frac{1.2 \times 20}{0.15} = \sv{160}\un{W/m^2}\\
\text{(b)}\quad q &= q''A = 160 \times 20 = \sv{3200}\un{W}\\
\text{(c)}\quad T(x) &= T_1 - (T_1 - T_2)\frac{x}{L} \qquad \text{(linear temperature profile)}\\
&= 30 - 20 \times \frac{0.05}{0.15} = \sv{23.3}\dC
\end{align*}
\ans{(a) $q'' = 160\un{W/m^2}$ \qquad (b) $q = 3200\un{W}$ \qquad (c) $T = 23.3\dC$}
\section*{Problem 2}
\begin{orig}
2. A window pane 8 mm thick with k = 0.78 W/(m·K) has an inner surface temperature of 15 °C. The outside air is at −5 °C, and the convection coefficient on the outer surface is h = 30 W/(m²·K). At steady state, find (a) the heat flux through the pane and (b) the outer surface temperature. Neglect radiation.
\end{orig}
\info{$L = 8\un{mm}$, $k = 0.78\un{W/(m\cdot K)}$, $T_{s,1} = 15\dC$, $T_\infty = -5\dC$, $h = 30\un{W/(m^2\cdot K)}$}
{(a) $q''$ \ (b) $T_{s,2}$}
{Steady, one-dimensional, no radiation, constant $k$}
\begin{align*}
R''_\text{cond} &= \frac{L}{k} = \frac{0.008}{0.78} = \sv{0.01026}\un{m^2\cdot K/W}\\
R''_\text{conv} &= \frac{1}{h} = \frac{1}{30} = \sv{0.03333}\un{m^2\cdot K/W}\\
\text{(a)}\quad q'' &= \frac{T_{s,1} - T_\infty}{R''_\text{cond} + R''_\text{conv}} = \frac{15 - (-5)}{0.01026 + 0.03333} = \frac{20}{0.04359} = \sv{458.8}\un{W/m^2}
\end{align*}
\nosol{(b) Outer surface temperature: the notes say ``couldn't solve''. It was not solved here for the student. Send your own solution and it will be typeset as written.}
\ans{(a) $q'' = 458.8\un{W/m^2}$ \qquad (b) no solution}
\section*{Problem 3}
\begin{orig}
3. A rectangular aluminum fin (k = 200 W/(m·K)) is 2 mm thick, 50 mm wide, and 40 mm long. The base is at 80 °C, the surrounding air is at 25 °C, and h = 25 W/(m²·K). Treat the fin tip as adiabatic and find (a) the fin parameter m, (b) the fin heat transfer rate, and (c) the fin efficiency.
\end{orig}
\info{$t = 2\un{mm}$, $w = 50\un{mm}$, $L = 40\un{mm}$, $k = 200\un{W/(m\cdot K)}$, $T_b = 80\dC$, $T_\infty = 25\dC$, $h = 25\un{W/(m^2\cdot K)}$}
{(a) $m$ \ (b) $q_f$ \ (c) $\eta_f$}
{Adiabatic tip (given in the problem)}
\begin{center}\begin{tikzpicture}[font=\small,>=stealth]
\fill[pattern=north east lines](-0.5,-1.1)rectangle(0,1.1);\draw(0,-1.1)--(0,1.1);
\draw[fill=black!10](0,-0.15)rectangle(4,0.15);\draw[line width=1.6pt](4,-0.15)--(4,0.15);
\node[left]at(-0.5,0){$T_b = 80\dC$};\node[right]at(4.1,0){adiabatic tip};
\draw[<->](0,-0.55)--(4,-0.55)node[midway,below]{$L = 40$ mm};
\draw[->](0.2,0.45)--(1.2,0.45)node[right]{$x$};
\node[anchor=west]at(0.3,0.95){air $T_\infty = 25\dC$, $h = 25$ W/(m$^2\cdot$K)};
\begin{scope}[xshift=7.6cm]
\draw[fill=black!10](-1.25,-0.15)rectangle(1.25,0.15);
\draw[<->](-1.25,-0.5)--(1.25,-0.5)node[midway,below]{$w = 50$ mm};
\draw[<->](1.45,-0.15)--(1.45,0.15)node[midway,right]{$t = 2$ mm};
\node at(0,0.6){cross-section};
\end{scope}
\end{tikzpicture}\end{center}
{\small Figure 1. The fin of Problem 3 from the side (left) and in cross-section (right). Thickness is exaggerated; only dimensions given in the problem are shown.}
\begin{align*}
P &= 2(w + t) = 2(0.05 + 0.002) = \sv{0.104}\un{m}\\
A_c &= wt = 0.05 \times 2 = \sv{0.1}\un{m^2}
\end{align*}
\chk{$A_c$ line: $w$ seems to be in m (0.05) and $t$ in mm (2), multiplied as written. The same expression in SI units differs by a factor of 1000. The $P$ line just above uses $t = 0.002$ m. Please also recheck $m$, $mL$, $M$, $q_f$, and $\eta_f$, which use this value. The 99.99 \% fin efficiency may come from this line too.}
\begin{align*}
\text{(a)}\quad m &= \sqrt{\frac{hP}{kA_c}} = \sqrt{\frac{25 \times 0.104}{200 \times 0.1}} = \sqrt{0.13} = \sv{0.3606}\un{m^{-1}}\\
mL &= 0.3606 \times 0.04 = \sv{0.01442}\\
M &= \sqrt{hPkA_c}\,\theta_b = \sqrt{25 \times 0.104 \times 200 \times 0.1} \times 55 = 7.211 \times 55 = \sv{396.6}\un{W}\\
\text{(b)}\quad q_f &= M\tanh(mL) = 396.6 \times 0.01442 = \sv{5.719}\un{W}\\
\text{(c)}\quad \eta_f &= \frac{\tanh(mL)}{mL} = \sv{0.9999} \quad (99.99\ \%)
\end{align*}
\ans{(a) $m = 0.3606\un{m^{-1}}$ \quad (b) $q_f = 5.719\un{W}$ \quad (c) $\eta_f = 0.9999$ \hfill{\small(check needed 1 open)}}
\end{document}
```
Attachment 2 · check_calc.py (Python)
```python
check_calc.py: checks the student's solution (my_solution.md). It never outputs a corrected value,
only where something looks wrong and why.
1) Is each problem statement (problems.txt) in homework.tex word for word?
2) Does each typeset number \sv{...} match the number in the notes?
3) Recompute each line from the student's previous-line values, in SI units. A 10^n ratio suggests a unit slip.
Run: python check_calc.py
import math
tex = open("homework.tex", encoding="utf-8").read()
memo = open("my_solution.md", encoding="utf-8").read()
for i, para in enumerate(open("problems.txt", encoding="utf-8").read().strip().split("\n\n"), 1):
print(f"problem text {i}:", "unchanged" if para.strip() in tex else "CHANGED: do not edit the problem text")
Numbers as written in the notes. None = a part the student did not solve: never fill it in
S = {"1a": "160", "1b": "3200", "1c": "23.3", "2Rk": "0.01026", "2Rh": "0.03333", "2a": "458.8", "2b": None,
"3P": "0.104", "3Ac": "0.1", "3m": "0.3606", "3mL": "0.01442", "3M": "396.6", "3q": "5.719", "3eta": "0.9999"}
v = {key: float(s) for key, s in S.items() if s}
Problem values in SI: thicknesses and lengths in m
k1, L1, A1 = 1.2, 0.15, 20.0
k2, L2, h2 = 0.78, 0.008, 30.0
k3, h3, w3, t3, L3, th3 = 200.0, 25.0, 0.050, 0.002, 0.040, 80.0 - 25.0
CALC = { # earlier lines use the student's values (v): only the wrong line is flagged, the error does not spread
"1a": lambda: k1 * (30 - 10) / L1, "1b": lambda: v["1a"] * A1, "1c": lambda: 30 - 20 * 0.05 / L1,
"2Rk": lambda: L2 / k2, "2Rh": lambda: 1 / h2, "2a": lambda: 20 / (v["2Rk"] + v["2Rh"]),
"3P": lambda: 2 * (w3 + t3), "3Ac": lambda: w3 * t3,
"3m": lambda: math.sqrt(h3 * v["3P"] / (k3 * v["3Ac"])), "3mL": lambda: v["3m"] * L3,
"3M": lambda: math.sqrt(h3 * v["3P"] * k3 * v["3Ac"]) * th3,
"3q": lambda: v["3M"] * math.tanh(v["3mL"]), "3eta": lambda: math.tanh(v["3mL"]) / v["3mL"],
}
flags = 0
for key, s in S.items():
if s is None:
flags += 1
print(f"{key:<5} no solution: not solved for the student")
continue
r = v[key] / CALC[key]()
n = round(math.log10(r))
if abs(r - 1) < 0.005:
msg = "correct"
elif n and abs(r / 10**n - 1) < 0.005:
msg = f"check needed: 10^{n} times the recomputed value, suspect a unit conversion"
else:
msg = f"check needed: {r:.3f} times the recomputed value"
flags += msg != "correct"
memo_ok = "in notes" if s in memo else "NOT in notes"
typeset = "typeset same" if "\\sv{" + s + "}" in tex else "typeset DIFFERENT"
print(f"{key:<5} {s:<8} {memo_ok}, {typeset}, {msg}")
marks = tex.count("\\chk{") + tex.count("\\nosol{")
print(f"to flag: {flags}, flags in homework.tex: {marks}:", "match" if flags == marks else "MISMATCH")
```
Attachment 3 · problems.txt (Text)
```text
1. A concrete wall 15 cm thick with thermal conductivity k = 1.2 W/(m·K) has its two surfaces held at 30 °C and 10 °C. The wall area is 20 m². Find (a) the heat flux, (b) the heat transfer rate, and (c) the temperature 5 cm in from the inner surface. Assume steady, one-dimensional conduction.
2. A window pane 8 mm thick with k = 0.78 W/(m·K) has an inner surface temperature of 15 °C. The outside air is at −5 °C, and the convection coefficient on the outer surface is h = 30 W/(m²·K). At steady state, find (a) the heat flux through the pane and (b) the outer surface temperature. Neglect radiation.
3. A rectangular aluminum fin (k = 200 W/(m·K)) is 2 mm thick, 50 mm wide, and 40 mm long. The base is at 80 °C, the surrounding air is at 25 °C, and h = 25 W/(m²·K). Treat the fin tip as adiabatic and find (a) the fin parameter m, (b) the fin heat transfer rate, and (c) the fin efficiency.
```
Attachment 4 · my_solution.md (Markdown)
```markdown
HW3, my solution (typed up from handwritten notes, numbers as written)
1
(a) q'' = k(T1 - T2)/L = 1.2 x 20 / 0.15 = 160 W/m^2
(b) q = q'' A = 160 x 20 = 3200 W
(c) temperature profile is linear -> T(x) = T1 - (T1 - T2) x/L = 30 - 20 x 0.05/0.15 = 23.3 C
assumptions: steady, 1D, no heat generation, k constant
2
R''cond = L/k = 0.008/0.78 = 0.01026 m^2 K/W
R''conv = 1/h = 1/30 = 0.03333 m^2 K/W
(a) q'' = (15 - (-5)) / (0.01026 + 0.03333) = 20/0.04359 = 458.8 W/m^2
(b) couldn't solve
assumptions: steady, 1D, no radiation, k constant
3
P = 2(w + t) = 2(0.05 + 0.002) = 0.104 m
Ac = w t = 0.05 x 2 = 0.1 m^2
(a) m = sqrt(hP/(k Ac)) = sqrt(25 x 0.104 / (200 x 0.1)) = sqrt(0.13) = 0.3606 1/m
mL = 0.3606 x 0.04 = 0.01442
M = sqrt(h P k Ac) theta_b = sqrt(25 x 0.104 x 200 x 0.1) x 55 = 7.211 x 55 = 396.6 W
(b) qf = M tanh(mL) = 396.6 x 0.01442 = 5.719 W
(c) eta_f = tanh(mL)/mL = 0.9999 (99.99 %)
```
Connect ChatGPT or Claude and use this prompt now · More prompts