1 / 14

2 Invariants

2 Invariants. Props A chocolate bar 5 paper cups. Invariants. An invariant is something that does not change. Other names you may be more familiar with are laws, patterns. Invariants in Maths and Science 1. Invariants are fundamentally important.

xaria
Télécharger la présentation

2 Invariants

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. 2 Invariants Props A chocolate bar 5 paper cups

  2. Invariants • An invariant is something that does not change. • Other names you may be more familiar with are laws, patterns.

  3. Invariants in Maths and Science 1 • Invariants are fundamentally important. • Maths 2.PI.radius = circumference • (or 2.PI.R – C= 0) • Chemistry H2 + O = H2O • (hydrogen + oxygen = water) • Conservation of mass

  4. Invariants in Maths and Science 2 • In Physics • Conservation of energy (e.g. vertical projectile) • Conservation of momentum (e.g. billiard balls) • Conversation of angular momentum (e.g. skater or person on swivel office chair). • Conservation of charge, lepton number, baryon number.

  5. Chocolate Bars • A rectangular chocolate bar is divided into chunks by horizontal and vertical grooves. • It is to be cut into individual squares. • A cut is made by taking a piece and cutting along a groove. This splits a piece into two pieces. • How many cuts are needed.

  6. Abstraction • How do we describe the state of the problem • Two variables. • P = number of pieces of chocolate • C = number of cuts • P and C describe the state of the chocolate bar • This description removes detail (e.g. it is chocolate, the order the cuts are made).

  7. Assignments • Model the cutting action / process • P, C := P+1, C+1 • := is read as “becomes” • This describes a change of state (like before and after) • NOTATION WARNING (==, = , :=) • Invariant is P-C (show working on board)

  8. Induction • Initially P=1 and C=0 • So initially P-C=1 • But P-C is invariant • When the bar is cut into S squares, P=S • S-C=1, that is C=S-1 • The number of cuts required is one less than the number of pieces

  9. Tumbler Problem • Several tumblers (cups or classes) are placed on a table. Some are the right way up, some are upside down. You can only turn over a pair of tumblers. You cannot turn over an individual tumbler (that would make the problem trivial). The aim/goal is to turn all the tumblers the right way up.

  10. Abstraction, Assignment • U is the number of tumblers upside down • (this does not record the position of the tumblers) • 3 cases • 1turn two tumblers the right way up (U:=U+2) • 2 turn two tumblers the wrong way up (U:=U-2) • 3 turn one the right way up and the other the wrong way up (U:=U+1-1) • What is an invariant of these 3 assignments?

  11. Invariant - Parity • Parity is a Boolean value (true or false) • True if (0, 2, 4, 6, …) • False if (1, 3, 5, 7, …) • Notation even.U • Invariant of U:=U+2 (show this) • Invariant of U:=U-2 (show this) • Modular arithmetic

  12. Solution • even.U is an invariant of the problem • no matter how many times we turn over pairs of tumbler, the value even.U will not change

  13. Review • Invariant – something that does not change • Abstraction – remove unnecessary detail and focus on the essential parts of the problem • Chocolate bar – the difference P-C was invariant • Inverting tumblers – the parity was invariant.

  14. Next Lecture • River crossing problems • Outline fox chicken grain

More Related