1 / 15

Computation and Programming: Boolean Algebra, Logical Operations, and Circuit Design

Learn about Boolean algebra, logical operations, and circuit design, and practice programming through exercises and examples.

vicini
Télécharger la présentation

Computation and Programming: Boolean Algebra, Logical Operations, and Circuit Design

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 情報基礎BLecture 7 Takeshi TokuyamaTohoku University Graduate School of Information SciencesSystem Information SciencesDesign and Analysis of Information Systems

  2. COMPUTATION AND PROGRAMMING

  3. Computation • The world of {0, 1} • Boolean algebra • Logical operation • AND operation • 0 × 0 = 0 × 1 = 1 × 0 = 0, 1 × 1 = 1 • Series circuit • OR operation • 0 + 0 = 0, 0 + 1 = 1 + 0 = 1, 1 + 1 = 1 • Parallel circuit • NOT operation • NOT(0) = 1, NOT(1) = 0 NOT

  4. Computation • AND operation • 0 × 0 = 0 × 1 = 1 × 0 = 0, 1 × 1 = 1 • Series circuit • Switching : relay, transistor, diode

  5. Computation • OR operation • 0 + 0 = 0, 0 + 1 = 1 + 0 = 1, 1 + 1 = 1 • Parallel circuit

  6. Computation • NOT operation • NOT(0) = 1, NOT(1) = 0 a electromanget NOT(a)

  7. Example of Adder • Circuit to calculate a + b (a, b = 0 or 1) a b 0 + 0 = 00 1 + 0 = 01 0 + 1 = 01 1 + 1 = 10 NOT Upper Bit Lower Bit

  8. Computation Model • AND, OR, NOT • Logical operation • Addition, subtraction, multiplication, division, comparison • IF • Programming model (decision tree model) • Addition, subtraction, multiplication, division, comparison • Load data from storage • Store data to storage • IF

  9. Program and Decision Tree IF(B2>=90, “A”, IF(B2>=80, “B”, IF(B2>=70, “C”, IF(B2>=60, “D”,“F”)))) B2 True False A True False B True False C True False D F Computation proceeds through the tree

  10. Loop • SUM(A2:A100) • Decision tree becomes deep • Loop structure • Loop management • When to stop? • In Excel… • By setting range A2:A100 Read a cell in column A Adder Temporal Result

  11. Loop • Example: SUM(A2:A100) i=2 i = i + 1 TRUE Read A(i) i<100 Adder FALSE Temporal Result Output Temporal Result

  12. Programming • Think about an algorithm • e.g. Grading procedure • Show a flowchart with decision tree and loop structure • Write the algorithm in programming language • Small vocabulary, easy

  13. Programming • Make an operation which a computer work on • Algorithm designing • Logical work • Coding • Learning a programming language • Read programs • Make some change on programs • Debug(Error correction)

  14. Programming hints • Learning programming language • Practice makes perfect • Follow examples • This is a pen > This is a dog • Follow good examples • Learn from the mistakes • This is a apple ?? • I is a man ?? • System will tell you mistakes • Guess what is wrong: logical mind and imagination

  15. Exercise • Write a flowchart of program that acts same as COUNTIF(B2:B21, “A”) without using COUNTIF

More Related