Cos 126 atomic theory of matter
Download
1 / 16

- PowerPoint PPT Presentation


  • 141 Views
  • Uploaded on

COS 126 – Atomic Theory of Matter. Announcements. Project – due Friday (1/12) midnight TA Office Hours this week (check website) Lab Help (Mon-Fri 7pm-9pm) Output should EXACTLY match examples Can use Diff.java (9.6) Start early…. Exam 2 – Pickup from your TA. Atomic Theory Overview.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about '' - kirestin-livingston


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cos 126 atomic theory of matter

COS 126 – Atomic Theory of Matter


Announcements
Announcements

  • Project – due Friday (1/12) midnight

    • TA Office Hours this week (check website)

    • Lab Help (Mon-Fri 7pm-9pm)

    • Output should EXACTLY match examples

      • Can use Diff.java (9.6)

    • Start early….

  • Exam 2 – Pickup from your TA


Atomic theory overview
Atomic Theory Overview

  • Brownian Motion

    • Random collision of molecules

    • Displacement over time fits a Gaussian distribution


Atomic theory overview1
Atomic Theory Overview

  • Avogadro’s Number

    • Number of atoms needed to equal substances atomic mass in grams

      • NA atoms of Carbon-12 = 12 grams

    • Can calculate from Brownian Motion

      • Variance of Gaussian distribution is a function of resistance in water, number of molecules


Bead java
Bead.java

  • Represent particles (beads) in water

  • API

    • public Bead()

    • public void add(int i, int j)

    • public int mass() // number of pixels

    • public double distanceTo(Bead b) // from center (average)

    • public String toString()

  • Only need 3 values to efficiently store

  • Thoroughly test (simple main)


Beadfinder java
BeadFinder.java

  • Locate all beads in a given image

  • API

    • public BeadFinder(Picture picture, double threshold)

      • Calculate luminance (see Luminance.java, 3.1)

        • Count pixels with at luminance > threshold

      • Find beads with DFS (see Percolation.java, 2.4)

        • The hard part, next slide…

    • public Bead[] getBeads(int minSize)

      • Returns all beads with at least minSize pixels

      • Array must be of size equal to number of beads


Bead finder depth first search
Bead Finder - Depth First Search

  • Use boolean[][] array to mark visited

  • Traverse image

    • Dark pixel – mark as visited, continue

    • Light pixel – create new bead, call dfs

  • DFS algorithm

    • If pixel out-of-bounds, return

    • If pixel has been visited, return

    • If pixel is dark, mark + return

    • Add pixel to current bead, mark as visited

    • Recursively visit up, down, left, right


Bead finder depth first search1
Bead Finder - Depth First Search

  • Use boolean[][] array to mark visited

  • Traverse image

    • Dark pixel – mark as visited, continue

    • Light pixel – create new bead, call dfs

  • DFS algorithm

    • If pixel out-of-bounds, return

    • If pixel has been visited, return

    • If pixel is dark, mark + return

    • Add pixel to current bead, mark as visited

    • Recursively visit up, down, left, right


Bead finder depth first search2
Bead Finder - Depth First Search

  • Use boolean[][] array to mark visited

  • Traverse image

    • Dark pixel – mark as visited, continue

    • Light pixel – create new bead, call dfs

  • DFS algorithm

    • If pixel out-of-bounds, return

    • If pixel has been visited, return

    • If pixel is dark, mark + return

    • Add pixel to current bead, mark as visited

    • Recursively visit up, down, left, right


Bead finder depth first search3
Bead Finder - Depth First Search

  • Use boolean[][] array to mark visited

  • Traverse image

    • Dark pixel – mark as visited, continue

    • Light pixel – create new bead, call dfs

  • DFS algorithm

    • If pixel out-of-bounds, return

    • If pixel has been visited, return

    • If pixel is dark, mark + return

    • Add pixel to current bead, mark as visited

    • Recursively visit up, down, left, right


Bead finder depth first search4
Bead Finder - Depth First Search

  • Use boolean[][] array to mark visited

  • Traverse image

    • Dark pixel – mark as visited, continue

    • Light pixel – create new bead, call dfs

  • DFS algorithm

    • If pixel out-of-bounds, return

    • If pixel has been visited, return

    • If pixel is dark, mark + return

    • Add pixel to current bead, mark as visited

    • Recursively visit up, down, left, right


Bead finder depth first search5
Bead Finder - Depth First Search

  • Use boolean[][] array to mark visited

  • Traverse image

    • Dark pixel – mark as visited, continue

    • Light pixel – create new bead, call dfs

  • DFS algorithm

    • If pixel out-of-bounds, return

    • If pixel has been visited, return

    • If pixel is dark, mark + return

    • Add pixel to current bead, mark as visited

    • Recursively visit up, down, left, right


Beadtracker java
BeadTracker.java

  • Track beads between successive images

  • Single main function

    • Take in a series of images

    • Output distance traversed by all beads for each time-step

      • For each bead found at time t+1, find closest bead at time t and calculate distance

        • Not the other way around!

        • Don’t include if distance > 25 pixels (new bead)


Avogadro java
Avogadro.java

  • Analyze Brownian motion of all calculated displacements

    • Lots of crazy formulas, all given, pretty straightforward

    • Be careful about units in the math, convert pixels to meters, etc.


Random thoughts
Random Thoughts…

  • BeadTracker and Avogadro are separate clients, must recompile both

  • Can still do Avogadro without other parts working, use sample input

  • Only keep at most two pictures open at a time (run out of memory otherwise)

  • Output format - System.out.printf()

    • "%6.3f" -> _2.354

    • "%10.4e" -> 1.2535e-23


Announcements1
Announcements

  • Project – due Friday (1/12) midnight

    • TA Office Hours this week (check website)

    • Lab Help (Mon-Fri 7pm-9pm)

    • Output should EXACTLY match examples

      • Can use Diff.java (9.6)

    • Start early….

  • Exam 2 – Pickup from your TA