Chaya·Edu EDU.CHAYA.DEV
ENGR 255Project 01 · Specification

Project Specification · Fall 2026

Project 01 — Torture a Bit

Week 2 said a bit is a ball in a double well. Week 3 said heat never stops kicking it. Today you build the well, hire the heat, and count the damage.

Weight25% of course grade
DueMon, Oct 19, 2026 · 11:59 PM
Hand inBrightspace
Budget~30 minutes
Late−10% per day

1The mission

You will run one small experiment: hold a bit behind an energy barrier, let thermal noise hammer on it, and count how many times the bit flips. Then raise the barrier and count again. That is the whole project.

The fun is the result. At a barrier of 2 thermal kicks, the bit is basically a coin toss — heat flips it constantly. At 6 thermal kicks, the same heat is still hammering just as hard, and the bit barely budges. You get to watch thermodynamics lose, in your own terminal, in about a second and a half of compute.

the barrier heat, kicking bit = 0 bit = 1 one flip = all the way over

Your bit, at work. The ball wants to stay put; the heat has other plans. A taller barrier means fewer successful break-ins.

Explicitly: no report, no spec sheets, no derivations. One script, one chart, one sentence.

2The script (provided — copy it)

This is the double-well simulation from Notes 03, section 8, with one change: instead of timing the first escape, it counts every flip — each time the ball makes it all the way into the other well. Copy it into a file named torture_a_bit.py:

"""Project 01 -- Torture a Bit.

What my chart says: (replace this line with ONE sentence in your own words)
"""
import numpy as np
import matplotlib.pyplot as plt

rng = np.random.default_rng()        # put a number inside () for repeatable kicks

def count_flips(barrier_kT, steps=400_000, dt=5e-4):
    """One ball in the double well V(x) = barrier * (x^2 - 1)^2, kicked by
    heat every timestep -- same physics as the Notes 03 escape-time snippet.
    A flip = the ball makes it all the way into the other well."""
    x, side, flips = -1.0, -1, 0                 # start in the left well: bit = 0
    kicks = np.sqrt(2 * dt) * rng.standard_normal(steps)   # all the heat, upfront
    for k in range(steps):
        F = -4.0 * barrier_kT * x * (x**2 - 1)   # the well pushing the ball home
        x += F * dt + kicks[k]
        if side == -1 and x > 1.0:               # made it to the right well
            side, flips = 1, flips + 1
        elif side == 1 and x < -1.0:             # made it back to the left
            side, flips = -1, flips + 1
    return flips

barriers = [2, 4, 6]                             # barrier height, in thermal kicks (kT)
counts = [count_flips(b) for b in barriers]
for b, c in zip(barriers, counts):
    print(f"barrier = {b} kT  ->  {c} flips")

plt.bar([f"{b} kT" for b in barriers], counts, color="#A2542A")
plt.xlabel("barrier height")
plt.ylabel("flips in one run")
plt.title("How many times heat beat the barrier")
plt.savefig("flips.png", dpi=150)
plt.show()

The last six lines are the whole chart: four of matplotlib plus a save and a show. Nothing else to build.

3Your whole job, in four moves

  1. Run it. python torture_a_bit.py — it takes a few seconds with the provided settings. Three barrier heights (2, 4, and 6 thermal kicks) are already in the barriers list.
  2. Read the damage. The script prints the flip count at each barrier height. Look at the three numbers. They should fall as the barrier grows.
  3. Keep the chart. The bar chart of flips vs. barrier height saves itself as flips.png. Screenshot it (or just use the file).
  4. Say what you saw. Replace the placeholder line in the docstring at the top of the file with one sentence, in your own words, about what the chart says.

What a run looks like

From my machine: barrier = 2 kT -> 41 flips, barrier = 4 kT -> 12 flips, barrier = 6 kT -> 3 flips. Your numbers will differ — the kicks are random — but the staircase down is the physics, and it will be there.

Optional: turn up the heat (+2 points, capped at 100)

Instead of lowering the barrier, make the heat stronger: multiply the kicks line by np.sqrt(3) — that is running the room three times hotter — and watch the 6 kT barrier start failing like the 2 kT one did. Add the extra run to your chart or print its count, plus one more sentence. That is the entire bonus.

4Hand in

Submit on Brightspace, by Mon, Oct 19, 11:59 PM

  • torture_a_bit.py — your copy of the script, with your sentence in the docstring.
  • A screenshot of your bar chart (or the flips.png it saves).

That is the complete submission. No report, no write-up, no repository. Late work loses 10% per calendar day.

5Grading — five checkboxes, 20 points each

CheckWhat I look forPoints
☐The script runs as submitted on my machine (python torture_a_bit.py, nothing else)20
☐Three barrier heights actually used20
☐The physics shows: flip counts fall as the barrier grows20
☐The chart matches the printed counts20
☐The docstring sentence is your own plain words about what you saw20
Total (bonus temperature experiment: +2, capped at 100)100

6Micro-FAQ

My counts are different from my friend's. Who is wrong?
Neither of you. The kicks are random, so every run is a different storm. Same staircase shape, different numbers — both right. (Want repeatable numbers? Put any integer inside default_rng().)
How long should the run be?
The provided settings — 400,000 steps per barrier, a few seconds of compute total. Don't change them unless you're doing the bonus; the grading checkboxes assume them.
Can I make the well prettier? Animate the ball?
Yes. Joy is allowed. Just know that the five checkboxes are what's graded, so get those green first.